@powerlines/plugin-rspack 0.5.111 โ†’ 0.5.113

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,11 +1,13 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./internal/babel/module-resolver-plugin.cjs`),n=require(`./internal/helpers/generate-types.cjs`),r=require(`./internal/helpers/hooks.cjs`),i=require(`./internal/helpers/install-dependencies.cjs`),a=require(`./lib/typescript/tsconfig.cjs`),o=require(`./internal/helpers/resolve-tsconfig.cjs`),s=require(`./plugin-utils/helpers.cjs`),c=require(`./lib/utilities/meta.cjs`),l=require(`./lib/contexts/api-context.cjs`),u=require(`./lib/utilities/file-header.cjs`);let d=require(`@storm-software/config-tools/types`),f=require(`@stryke/path/join-paths`),p=require(`@babel/core`),m=require(`@storm-software/config-tools/logger/console`),h=require(`@stryke/convert/to-array`),g=require(`@stryke/fs/helpers`),_=require(`@stryke/fs/install`),v=require(`@stryke/fs/list-files`),y=require(`@stryke/fs/package-fns`),b=require(`@stryke/fs/resolve`),x=require(`@stryke/path/append`),S=require(`@stryke/path/replace`),C=require(`@stryke/type-checks/is-error`),w=require(`@stryke/type-checks/is-function`),T=require(`@stryke/type-checks/is-number`),E=require(`@stryke/type-checks/is-object`),D=require(`@stryke/type-checks/is-promise`),O=require(`@stryke/type-checks/is-set`),k=require(`@stryke/type-checks/is-set-object`),A=require(`@stryke/type-checks/is-set-string`),j=require(`chalk`);j=e.__toESM(j);let M=require(`handlebars`);M=e.__toESM(M);var N=class e{#e;get context(){return this.#e}constructor(e){this.#e=e}static async from(t,n){let r=new e(await l.PowerlinesAPIContext.from(t,n));r.#e.$$internal={api:r,addPlugin:r.#i.bind(r)};for(let e of r.context.config.plugins??[])await r.#i(e);r.context.plugins.length===0&&r.context.log(d.LogLevelLabel.WARN,`No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.`);let i=await r.callHook(`config`,{environment:await r.context.getEnvironment(),sequential:!0,result:`merge`});return await r.context.withUserConfig(i,{isHighPriority:!1}),r}async prepare(e={command:`prepare`}){this.context.log(d.LogLevelLabel.TRACE,` ๐Ÿ—๏ธ Preparing the Powerlines project`),this.context.log(d.LogLevelLabel.TRACE,` โš™๏ธ Aggregating configuration options for the Powerlines project`),await this.context.withInlineConfig(e),await this.#r(async e=>{if(e.log(d.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`configResolved`,{environment:e,order:`pre`}),await o.initializeTsconfig(e),await this.callHook(`configResolved`,{environment:e,order:`normal`}),e.log(d.LogLevelLabel.DEBUG,`The configuration provided ${(0,h.toArray)(e.config.entry).length} entry point(s), Powerlines has found ${e.entry.length} entry files(s) for the ${e.config.title} project${e.entry.length>0&&e.entry.length<10?`: \n${e.entry.map(e=>`- ${e.file}${e.output?` -> ${e.output}`:``}`).join(`
1
+ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./internal/babel/module-resolver-plugin.cjs`),n=require(`./internal/helpers/generate-types.cjs`),r=require(`./internal/helpers/hooks.cjs`),i=require(`./internal/helpers/install-dependencies.cjs`),a=require(`./lib/typescript/tsconfig.cjs`),o=require(`./internal/helpers/resolve-tsconfig.cjs`),s=require(`./plugin-utils/helpers.cjs`),c=require(`./lib/utilities/meta.cjs`),l=require(`./lib/contexts/api-context.cjs`),u=require(`./lib/utilities/file-header.cjs`);let d=require(`@storm-software/config-tools/types`),f=require(`@stryke/path/join-paths`),p=require(`@babel/core`),m=require(`@storm-software/config-tools/logger/console`),h=require(`@stryke/convert/to-array`),g=require(`@stryke/fs/helpers`),_=require(`@stryke/fs/install`),v=require(`@stryke/fs/list-files`),y=require(`@stryke/fs/package-fns`),b=require(`@stryke/fs/resolve`),x=require(`@stryke/path/append`),S=require(`@stryke/path/replace`),C=require(`@stryke/type-checks/is-error`),w=require(`@stryke/type-checks/is-function`),T=require(`@stryke/type-checks/is-number`),E=require(`@stryke/type-checks/is-object`),D=require(`@stryke/type-checks/is-promise`),O=require(`@stryke/type-checks/is-set`),k=require(`@stryke/type-checks/is-set-object`),A=require(`@stryke/type-checks/is-set-string`),j=require(`@stryke/type-checks/is-string`),M=require(`chalk`);M=e.__toESM(M);let N=require(`handlebars`);N=e.__toESM(N);var P=class e{#e;get context(){return this.#e}constructor(e){this.#e=e}static async from(t,n){let r=new e(await l.PowerlinesAPIContext.from(t,n));r.#e.$$internal={api:r,addPlugin:r.#i.bind(r)};for(let e of r.context.config.plugins??[])await r.#i(e);r.context.plugins.length===0&&r.context.log(d.LogLevelLabel.WARN,`No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.`);let i=await r.callHook(`config`,{environment:await r.context.getEnvironment(),sequential:!0,result:`merge`});return await r.context.withUserConfig(i,{isHighPriority:!1}),r}async prepare(e={command:`prepare`}){this.context.log(d.LogLevelLabel.TRACE,` ๐Ÿ—๏ธ Preparing the Powerlines project`),this.context.log(d.LogLevelLabel.TRACE,` โš™๏ธ Aggregating configuration options for the Powerlines project`),await this.context.withInlineConfig(e),await this.#r(async e=>{if(e.log(d.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`configResolved`,{environment:e,order:`pre`}),await o.initializeTsconfig(e),await this.callHook(`configResolved`,{environment:e,order:`normal`}),e.log(d.LogLevelLabel.DEBUG,`The configuration provided ${(0,h.toArray)(e.config.entry).length} entry point(s), Powerlines has found ${e.entry.length} entry files(s) for the ${e.config.title} project${e.entry.length>0&&e.entry.length<10?`: \n${e.entry.map(e=>`- ${e.file}${e.output?` -> ${e.output}`:``}`).join(`
2
2
  `)}`:``}.`),await o.resolveTsconfig(e),await i.installDependencies(e),await this.callHook(`configResolved`,{environment:e,order:`post`}),e.log(d.LogLevelLabel.TRACE,`Powerlines configuration has been resolved: \n\n${(0,m.formatLogMessage)(e.config)}`),e.fs.existsSync(e.cachePath)||await(0,g.createDirectory)(e.cachePath),e.fs.existsSync(e.dataPath)||await(0,g.createDirectory)(e.dataPath),await this.callHook(`prepare`,{environment:e,order:`pre`}),await this.callHook(`prepare`,{environment:e,order:`normal`}),e.config.output.dts!==!1){e.log(d.LogLevelLabel.TRACE,`Preparing the TypeScript definitions for the Powerlines project.`),e.fs.existsSync(e.dtsPath)&&await e.fs.remove(e.dtsPath),e.log(d.LogLevelLabel.TRACE,`Transforming built-ins runtime modules files.`);let r=await Promise.all((await e.getBuiltins()).map(async n=>{let r=await(0,p.transformAsync)(n.code.toString(),{highlightCode:!0,code:!0,ast:!1,cloneInputAst:!1,comments:!0,sourceType:`module`,configFile:!1,babelrc:!1,envName:e.config.mode,caller:{name:`powerlines`},...e.config.transform.babel,filename:n.path,plugins:[[`@babel/plugin-syntax-typescript`],[t.moduleResolverBabelPlugin(e)]]});if(!r?.code)throw Error(`Powerlines - Generate Types failed to compile ${n.id}`);return e.log(d.LogLevelLabel.TRACE,`Writing transformed built-in runtime file ${n.id}.`),await e.emitBuiltin(r.code,n.id,n.path),n.path}));if(!await(0,b.resolvePackage)(`typescript`))throw Error(`Could not resolve TypeScript package location. Please ensure TypeScript is installed.`);let i=r.reduce((t,n)=>{let r=(0,S.replacePath)(n,e.workspaceConfig.workspaceRoot);return t.includes(r)||t.push(r),t},[]);e.log(d.LogLevelLabel.TRACE,`Parsing TypeScript configuration for the Powerlines project.`);let s=await n.emitTypes(e,i);e.log(d.LogLevelLabel.TRACE,`Generating TypeScript declaration file ${e.dtsPath}.`);let c=[],l=e=>(0,E.isObject)(e)?e.code:e,f=await this.callHook(`types`,{environment:e,sequential:!0,order:`pre`,result:`merge`,asNextParam:l},s);if(f&&((0,k.isSetObject)(f)?(s=f.code,Array.isArray(f.directives)&&f.directives.length>0&&c.push(...f.directives)):(0,A.isSetString)(f)&&(s=f)),f=await this.callHook(`types`,{environment:e,sequential:!0,order:`normal`,result:`merge`,asNextParam:l},s),f&&((0,k.isSetObject)(f)?(s=f.code,Array.isArray(f.directives)&&f.directives.length>0&&c.push(...f.directives)):(0,A.isSetString)(f)&&(s=f)),f=await this.callHook(`types`,{environment:e,sequential:!0,order:`post`,result:`merge`,asNextParam:l},s),f&&((0,k.isSetObject)(f)?(s=f.code,Array.isArray(f.directives)&&f.directives.length>0&&c.push(...f.directives)):(0,A.isSetString)(f)&&(s=f)),s?.trim()||c.length>0)await e.fs.write(e.dtsPath,`${c?`${c.map(e=>`/// <reference types="${e}" />`).join(`
3
3
  `)}
4
4
 
5
5
  `:``}${u.getFileHeader(e,{directive:null,prettierIgnore:!1})}
6
6
 
7
7
  ${n.formatTypes(s)}
8
- `);else{let t=o.getTsconfigDtsPath(e);if(e.tsconfig.tsconfigJson.include&&a.isIncludeMatchFound(t,e.tsconfig.tsconfigJson.include)){let n=t.startsWith(`./`)?t.slice(2):t;e.tsconfig.tsconfigJson.include=e.tsconfig.tsconfigJson.include.filter(e=>e?.toString()!==n),await e.fs.write(e.tsconfig.tsconfigFilePath,JSON.stringify(e.tsconfig.tsconfigJson,null,2))}}}if(e.tsconfig=a.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig),!e.tsconfig)throw Error(`Failed to parse the TypeScript configuration file.`);await this.callHook(`prepare`,{environment:e,order:`post`}),await c.writeMetaFile(e),e.persistedMeta=e.meta}),this.context.log(d.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ†• Creating a new Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.log(d.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}if(await this.callHook(`new`,{environment:e,order:`normal`}),e.config.projectType===`application`){let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}await this.callHook(`new`,{environment:e,order:`post`})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿงน Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#r(async e=>{this.context.log(d.LogLevelLabel.TRACE,`Cleaning the project's dist and artifacts directories.`),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.artifactsPath)),await this.callHook(`clean`,{environment:e,sequential:!1})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“‹ Linting the Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.config.lint!==!1&&await this.callHook(`lint`,{environment:e,sequential:!1})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“ฆ Building the Powerlines project`),await this.prepare(e),this.context.config.singleBuild?await this.#t(await this.#e.toEnvironment()):await this.#r(async e=>{await this.#t(e)}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ““ Generating documentation for the Powerlines project`),await this.prepare(e),await this.#r(async t=>{t.log(d.LogLevelLabel.TRACE,`Writing documentation for the Powerlines project artifacts.`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`docs`,{environment:e})})}),this.#e.log(d.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“ฆ Deploying the Powerlines project`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(d.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#r(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines finalize execution completed`)}async callHook(e,t,...n){return r.callHook((0,k.isSetObject)(t?.environment)?t.environment:await this.#e.getEnvironment(t?.environment),e,{sequential:!0,...t},...n)}async[Symbol.asyncDispose](){await this.finalize()}async#t(e){if(await this.callHook(`build`,{environment:e,order:`pre`}),await this.callHook(`build`,{environment:e,order:`normal`}),e.config.output.buildPath!==e.config.output.outputPath){let t=(0,x.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,f.joinPaths)((0,x.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);e.fs.existsSync(t)&&t!==n&&(e.log(d.LogLevelLabel.INFO,`Copying build output files from project's build directory (${e.config.output.buildPath}) to the workspace's output directory (${e.config.output.outputPath}).`),await e.fs.copy(t,n))}await Promise.all(e.config.output.assets.map(async t=>{e.log(d.LogLevelLabel.DEBUG,`Copying asset(s): ${j.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,f.joinPaths)((0,S.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,f.joinPaths)((0,S.replacePath)(t.output,e.workspaceConfig.workspaceRoot),t.glob))} ${Array.isArray(t.ignore)&&t.ignore.length>0?` (ignoring: ${t.ignore.map(e=>j.default.yellowBright(e)).join(`, `)})`:``}`),await e.fs.copy(t,t.output)})),await this.callHook(`build`,{environment:e,order:`post`})}async#n(){return!this.context.config.environments||Object.keys(this.context.config.environments).length<=1?(this.context.log(d.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(d.LogLevelLabel.DEBUG,`Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`),(await Promise.all(Object.entries(this.context.config.environments).map(async([e,t])=>{if(!await this.context.getEnvironmentSafe(e)){let n=await this.callHook(`configEnvironment`,{environment:e},e,t);n&&(this.context.environments[e]=await this.context.in(n))}return this.context.environments[e]}))).filter(e=>(0,O.isSet)(e)))}async#r(e){await Promise.all((await this.#n()).map(async t=>Promise.resolve(e(t))))}async#i(e){if(e){let t=await this.#a(e);if(!t)return;for(let e of t)this.context.log(d.LogLevelLabel.DEBUG,`Successfully initialized the ${j.default.bold.cyanBright(e.name)} plugin`),await this.context.addPlugin(e)}}async#a(e){let t=e;if((0,D.isPromiseLike)(e)&&(t=await Promise.resolve(e)),!s.isPluginConfig(t))throw Error(`Invalid plugin specified in the configuration - ${JSON.stringify(t)}. Please ensure the value is a plugin name, an object with the \`plugin\` and \`props\` properties, or an instance of \`Plugin\`.`);let n;if(Array.isArray(t)&&t.every(s.isPlugin))n=t;else if(s.isPlugin(t))n=[t];else if((0,w.isFunction)(t))n=(0,h.toArray)(await Promise.resolve(t()));else if((0,A.isSetString)(t)){let e=await this.#o(t);n=(0,w.isFunction)(e)?(0,h.toArray)(await Promise.resolve(e())):(0,h.toArray)(e)}else if(s.isPluginConfigTuple(t)||s.isPluginConfigObject(t)){let e,r;if(s.isPluginConfigTuple(t)?(e=t[0],r=t?.length===2?t[1]:void 0):(e=t.plugin,r=t.options),(0,A.isSetString)(e)){let t=await this.#o(e);n=(0,w.isFunction)(t)?(0,h.toArray)(await Promise.resolve(r?t(r):t())):(0,h.toArray)(t)}else (0,w.isFunction)(e)?n=(0,h.toArray)(await Promise.resolve(e(r))):Array.isArray(e)&&e.every(s.isPlugin)?n=e:s.isPlugin(e)&&(n=(0,h.toArray)(e))}if(!n)throw Error(`The plugin configuration ${JSON.stringify(t)} is invalid. This configuration must point to a valid Powerlines plugin module.`);if(n.length>0&&!n.every(s.isPlugin))throw Error(`The plugin option ${JSON.stringify(n)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);let r=[];for(let e of n)s.checkDedupe(e,this.context.plugins)?this.context.log(d.LogLevelLabel.TRACE,`Duplicate ${j.default.bold.cyanBright(e.name)} plugin dependency detected - Skipping initialization.`):(r.push(e),this.context.log(d.LogLevelLabel.TRACE,`Initializing the ${j.default.bold.cyanBright(e.name)} plugin...`));return r}async#o(e){if(e.startsWith(`@`)&&e.split(`/`).filter(Boolean).length>2){let t=e.split(`/`).filter(Boolean);e=`${t[0]}/${t[1]}`}let t=(0,y.isPackageExists)(e,{paths:[this.context.workspaceConfig.workspaceRoot,this.context.config.projectRoot]});if(!t&&this.context.config.skipInstalls!==!0){this.#e.log(d.LogLevelLabel.WARN,`The plugin package "${e}" is not installed. It will be installed automatically.`);let t=await(0,_.install)(e,{cwd:this.context.config.projectRoot});if((0,T.isNumber)(t.exitCode)&&t.exitCode>0)throw this.#e.log(d.LogLevelLabel.ERROR,t.stderr),Error(`An error occurred while installing the build plugin package "${e}" `)}try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve((0,f.joinPaths)(e,`plugin`))),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch(n){try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(e)),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch{throw t?Error(`An error occurred while importing the build plugin package "${e}":
8
+ `);else{let t=o.getTsconfigDtsPath(e);if(e.tsconfig.tsconfigJson.include&&a.isIncludeMatchFound(t,e.tsconfig.tsconfigJson.include)){let n=t.startsWith(`./`)?t.slice(2):t;e.tsconfig.tsconfigJson.include=e.tsconfig.tsconfigJson.include.filter(e=>e?.toString()!==n),await e.fs.write(e.tsconfig.tsconfigFilePath,JSON.stringify(e.tsconfig.tsconfigJson,null,2))}}}if(e.tsconfig=a.getParsedTypeScriptConfig(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.config.tsconfig),!e.tsconfig)throw Error(`Failed to parse the TypeScript configuration file.`);await this.callHook(`prepare`,{environment:e,order:`post`}),await c.writeMetaFile(e),e.persistedMeta=e.meta}),this.context.log(d.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ†• Creating a new Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.log(d.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=N.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}if(await this.callHook(`new`,{environment:e,order:`normal`}),e.config.projectType===`application`){let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=N.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,v.listFiles)((0,f.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(d.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=N.default.compile(n);await e.fs.write((0,f.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}await this.callHook(`new`,{environment:e,order:`post`})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿงน Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#r(async e=>{this.context.log(d.LogLevelLabel.TRACE,`Cleaning the project's dist and artifacts directories.`),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,f.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.artifactsPath)),await this.callHook(`clean`,{environment:e,sequential:!1})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“‹ Linting the Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.config.lint!==!1&&await this.callHook(`lint`,{environment:e,sequential:!1})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“ฆ Building the Powerlines project`),await this.prepare(e),this.context.config.singleBuild?await this.#t(await this.#e.toEnvironment()):await this.#r(async e=>{await this.#t(e)}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ““ Generating documentation for the Powerlines project`),await this.prepare(e),await this.#r(async t=>{t.log(d.LogLevelLabel.TRACE,`Writing documentation for the Powerlines project artifacts.`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`docs`,{environment:e})})}),this.#e.log(d.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(d.LogLevelLabel.INFO,`๐Ÿ“ฆ Deploying the Powerlines project`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(d.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#r(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(d.LogLevelLabel.TRACE,`Powerlines finalize execution completed`)}async callHook(e,t,...n){return r.callHook((0,k.isSetObject)(t?.environment)?t.environment:await this.#e.getEnvironment(t?.environment),e,{sequential:!0,...t},...n)}async[Symbol.asyncDispose](){await this.finalize()}async#t(e){if(await this.callHook(`build`,{environment:e,order:`pre`}),await this.callHook(`build`,{environment:e,order:`normal`}),e.config.output.buildPath!==e.config.output.outputPath){let t=(0,x.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,f.joinPaths)((0,x.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);e.fs.existsSync(t)&&t!==n&&(e.log(d.LogLevelLabel.INFO,`Copying build output files from project's build directory (${e.config.output.buildPath}) to the workspace's output directory (${e.config.output.outputPath}).`),await e.fs.copy(t,n))}await Promise.all(e.config.output.assets.map(async t=>{e.log(d.LogLevelLabel.DEBUG,`Copying asset(s): ${M.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,f.joinPaths)((0,S.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${M.default.greenBright((0,f.joinPaths)((0,S.replacePath)(t.output,e.workspaceConfig.workspaceRoot),t.glob))} ${Array.isArray(t.ignore)&&t.ignore.length>0?` (ignoring: ${t.ignore.map(e=>M.default.yellowBright(e)).join(`, `)})`:``}`),await e.fs.copy(t,t.output)})),await this.callHook(`build`,{environment:e,order:`post`})}async#n(){return!this.context.config.environments||Object.keys(this.context.config.environments).length<=1?(this.context.log(d.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(d.LogLevelLabel.DEBUG,`Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`),(await Promise.all(Object.entries(this.context.config.environments).map(async([e,t])=>{if(!await this.context.getEnvironmentSafe(e)){let n=await this.callHook(`configEnvironment`,{environment:e},e,t);n&&(this.context.environments[e]=await this.context.in(n))}return this.context.environments[e]}))).filter(e=>(0,O.isSet)(e)))}async#r(e){await Promise.all((await this.#n()).map(async t=>Promise.resolve(e(t))))}async#i(e){if(e){let t=await this.#a(e);if(!t)return;for(let e of t)this.context.log(d.LogLevelLabel.DEBUG,`Successfully initialized the ${M.default.bold.cyanBright(e.name)} plugin`),await this.context.addPlugin(e)}}async#a(e){let t=e;if((0,D.isPromiseLike)(e)&&(t=await Promise.resolve(e)),!s.isPluginConfig(t)){let e=s.findInvalidPluginConfig(t);throw Error(`Invalid ${e&&e.length>1?`plugins`:`plugin`} specified in the configuration - ${e&&e.length>0?JSON.stringify(t):e?.join(`
9
+
10
+ `)} \n\nPlease ensure the value is one of the following: \n - an instance of \`Plugin\` \n - a plugin name \n - an object with the \`plugin\` and \`options\` properties \n - a tuple array with the plugin and options \n - a factory function that returns a plugin or array of plugins \n - an array of plugins or plugin configurations`)}let n;if(s.isPlugin(t))n=[t];else if((0,w.isFunction)(t))n=(0,h.toArray)(await Promise.resolve(t()));else if((0,j.isString)(t)){let e=await this.#o(t);n=(0,w.isFunction)(e)?(0,h.toArray)(await Promise.resolve(e())):(0,h.toArray)(e)}else if(Array.isArray(t)&&t.every(s.isPlugin))n=t;else if(Array.isArray(t)&&t.every(s.isPluginConfig)){n=[];for(let e of t){let t=await this.#a(e);t&&n.push(...t)}}else if(s.isPluginConfigTuple(t)||s.isPluginConfigObject(t)){let e,r;if(s.isPluginConfigTuple(t)?(e=t[0],r=t?.length===2?t[1]:void 0):(e=t.plugin,r=t.options),(0,A.isSetString)(e)){let t=await this.#o(e);n=(0,w.isFunction)(t)?(0,h.toArray)(await Promise.resolve(r?t(r):t())):(0,h.toArray)(t)}else (0,w.isFunction)(e)?n=(0,h.toArray)(await Promise.resolve(e(r))):Array.isArray(e)&&e.every(s.isPlugin)?n=e:s.isPlugin(e)&&(n=(0,h.toArray)(e))}if(!n)throw Error(`The plugin configuration ${JSON.stringify(t)} is invalid. This configuration must point to a valid Powerlines plugin module.`);if(n.length>0&&!n.every(s.isPlugin))throw Error(`The plugin option ${JSON.stringify(n)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);let r=[];for(let e of n)s.checkDedupe(e,this.context.plugins)?this.context.log(d.LogLevelLabel.TRACE,`Duplicate ${M.default.bold.cyanBright(e.name)} plugin dependency detected - Skipping initialization.`):(r.push(e),this.context.log(d.LogLevelLabel.TRACE,`Initializing the ${M.default.bold.cyanBright(e.name)} plugin...`));return r}async#o(e){if(e.startsWith(`@`)&&e.split(`/`).filter(Boolean).length>2){let t=e.split(`/`).filter(Boolean);e=`${t[0]}/${t[1]}`}let t=(0,y.isPackageExists)(e,{paths:[this.context.workspaceConfig.workspaceRoot,this.context.config.projectRoot]});if(!t&&this.context.config.skipInstalls!==!0){this.#e.log(d.LogLevelLabel.WARN,`The plugin package "${e}" is not installed. It will be installed automatically.`);let t=await(0,_.install)(e,{cwd:this.context.config.projectRoot});if((0,T.isNumber)(t.exitCode)&&t.exitCode>0)throw this.#e.log(d.LogLevelLabel.ERROR,t.stderr),Error(`An error occurred while installing the build plugin package "${e}" `)}try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve((0,f.joinPaths)(e,`plugin`))),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch(n){try{let t=await this.context.resolver.plugin.import(this.context.resolver.plugin.esmResolve(e)),n=t.plugin??t.default;if(!n)throw Error(`The plugin package "${e}" does not export a valid module.`);return n}catch{throw t?Error(`An error occurred while importing the build plugin package "${e}":
9
11
  ${(0,C.isError)(n)?n.message:String(n)}
10
12
 
11
13
  Note: Please ensure the plugin package's default export is a class that extends \`Plugin\` with a constructor that excepts a single arguments of type \`PluginOptions\`.`):Error(`The plugin package "${e}" is not installed. Please install the package using the command: "npm install ${e} --save-dev"`)}}}};
@@ -1 +1 @@
1
- import{moduleResolverBabelPlugin as e}from"./internal/babel/module-resolver-plugin.mjs";import{emitTypes as t,formatTypes as n}from"./internal/helpers/generate-types.mjs";import{callHook as r}from"./internal/helpers/hooks.mjs";import{installDependencies as i}from"./internal/helpers/install-dependencies.mjs";import{getParsedTypeScriptConfig as a,isIncludeMatchFound as o}from"./lib/typescript/tsconfig.mjs";import{getTsconfigDtsPath as s,initializeTsconfig as c,resolveTsconfig as l}from"./internal/helpers/resolve-tsconfig.mjs";import{checkDedupe as u,isPlugin as d,isPluginConfig as f,isPluginConfigObject as p,isPluginConfigTuple as m}from"./plugin-utils/helpers.mjs";import{writeMetaFile as h}from"./lib/utilities/meta.mjs";import{PowerlinesAPIContext as g}from"./lib/contexts/api-context.mjs";import{getFileHeader as _}from"./lib/utilities/file-header.mjs";import{LogLevelLabel as v}from"@storm-software/config-tools/types";import{joinPaths as y}from"@stryke/path/join-paths";import{transformAsync as b}from"@babel/core";import{formatLogMessage as x}from"@storm-software/config-tools/logger/console";import{toArray as S}from"@stryke/convert/to-array";import{createDirectory as C}from"@stryke/fs/helpers";import{install as w}from"@stryke/fs/install";import{listFiles as T}from"@stryke/fs/list-files";import{isPackageExists as E}from"@stryke/fs/package-fns";import{resolvePackage as D}from"@stryke/fs/resolve";import{appendPath as O}from"@stryke/path/append";import{replacePath as k}from"@stryke/path/replace";import{isError as A}from"@stryke/type-checks/is-error";import{isFunction as j}from"@stryke/type-checks/is-function";import{isNumber as M}from"@stryke/type-checks/is-number";import{isObject as N}from"@stryke/type-checks/is-object";import{isPromiseLike as P}from"@stryke/type-checks/is-promise";import{isSet as F}from"@stryke/type-checks/is-set";import{isSetObject as I}from"@stryke/type-checks/is-set-object";import{isSetString as L}from"@stryke/type-checks/is-set-string";import R from"chalk";import z from"handlebars";Symbol.asyncDispose;export{};
1
+ import{moduleResolverBabelPlugin as e}from"./internal/babel/module-resolver-plugin.mjs";import{emitTypes as t,formatTypes as n}from"./internal/helpers/generate-types.mjs";import{callHook as r}from"./internal/helpers/hooks.mjs";import{installDependencies as i}from"./internal/helpers/install-dependencies.mjs";import{getParsedTypeScriptConfig as a,isIncludeMatchFound as o}from"./lib/typescript/tsconfig.mjs";import{getTsconfigDtsPath as s,initializeTsconfig as c,resolveTsconfig as l}from"./internal/helpers/resolve-tsconfig.mjs";import{checkDedupe as u,findInvalidPluginConfig as d,isPlugin as f,isPluginConfig as p,isPluginConfigObject as m,isPluginConfigTuple as h}from"./plugin-utils/helpers.mjs";import{writeMetaFile as g}from"./lib/utilities/meta.mjs";import{PowerlinesAPIContext as _}from"./lib/contexts/api-context.mjs";import{getFileHeader as v}from"./lib/utilities/file-header.mjs";import{LogLevelLabel as y}from"@storm-software/config-tools/types";import{joinPaths as b}from"@stryke/path/join-paths";import{transformAsync as x}from"@babel/core";import{formatLogMessage as S}from"@storm-software/config-tools/logger/console";import{toArray as C}from"@stryke/convert/to-array";import{createDirectory as w}from"@stryke/fs/helpers";import{install as T}from"@stryke/fs/install";import{listFiles as E}from"@stryke/fs/list-files";import{isPackageExists as D}from"@stryke/fs/package-fns";import{resolvePackage as O}from"@stryke/fs/resolve";import{appendPath as k}from"@stryke/path/append";import{replacePath as A}from"@stryke/path/replace";import{isError as j}from"@stryke/type-checks/is-error";import{isFunction as M}from"@stryke/type-checks/is-function";import{isNumber as N}from"@stryke/type-checks/is-number";import{isObject as P}from"@stryke/type-checks/is-object";import{isPromiseLike as F}from"@stryke/type-checks/is-promise";import{isSet as I}from"@stryke/type-checks/is-set";import{isSetObject as L}from"@stryke/type-checks/is-set-object";import{isSetString as R}from"@stryke/type-checks/is-set-string";import{isString as z}from"@stryke/type-checks/is-string";import B from"chalk";import V from"handlebars";Symbol.asyncDispose;export{};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`defu`),r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-object`),a=require(`@stryke/type-checks/is-set`),o=require(`chalk`);o=e.__toESM(o);let s=require(`@stryke/type-checks/is-string`);const c=(0,n.createDefu)((e,t,n)=>(0,s.isString)(e[t])&&(0,s.isString)(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(e,l,u,...d){let f=e.selectHooks(l,u);if(f.length>0){e.log(t.LogLevelLabel.DEBUG,` ๐Ÿงฉ Calling plugin hook: ${o.default.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!(0,r.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!(0,r.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&(0,a.isSet)(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=(0,r.isFunction)(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let n=await Promise.resolve(e.handle.apply(e.context,[...t]));n&&(u?.result===`last`?p=[n]:(0,s.isString)(n)?p=[`${(0,s.isString)(p[0])&&p[0]||``}\n${n||``}`.trim()]:(0,i.isObject)(n)&&(p=[c(n,p[0]??{})]))}}let m=p.filter(e=>(0,a.isSet)(e));if(m.length>0){let e;for(let t of m)e=(0,n.defu)(t,e??{});return e}}}exports.callHook=l;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`defu`),r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-object`),a=require(`@stryke/type-checks/is-set`),o=require(`@stryke/type-checks/is-string`),s=require(`chalk`);s=e.__toESM(s);const c=(0,n.createDefu)((e,t,n)=>(0,o.isString)(e[t])&&(0,o.isString)(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(e,l,u,...d){let f=e.selectHooks(l,u);if(f.length>0){e.log(t.LogLevelLabel.DEBUG,` ๐Ÿงฉ Calling plugin hook: ${s.default.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!(0,r.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!(0,r.isFunction)(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&(0,a.isSet)(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=(0,r.isFunction)(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let n=await Promise.resolve(e.handle.apply(e.context,[...t]));n&&(u?.result===`last`?p=[n]:(0,o.isString)(n)?p=[`${(0,o.isString)(p[0])&&p[0]||``}\n${n||``}`.trim()]:(0,i.isObject)(n)&&(p=[c(n,p[0]??{})]))}}let m=p.filter(e=>(0,a.isSet)(e));if(m.length>0){let e;for(let t of m)e=(0,n.defu)(t,e??{});return e}}}exports.callHook=l;
@@ -1 +1 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{createDefu as t,defu as n}from"defu";import{isFunction as r}from"@stryke/type-checks/is-function";import{isObject as i}from"@stryke/type-checks/is-object";import{isSet as a}from"@stryke/type-checks/is-set";import o from"chalk";import{isString as s}from"@stryke/type-checks/is-string";const c=t((e,t,n)=>s(e[t])&&s(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(t,l,u,...d){let f=t.selectHooks(l,u);if(f.length>0){t.log(e.DEBUG,` ๐Ÿงฉ Calling plugin hook: ${o.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!r(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!r(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&a(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=r(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let n=await Promise.resolve(e.handle.apply(e.context,[...t]));n&&(u?.result===`last`?p=[n]:s(n)?p=[`${s(p[0])&&p[0]||``}\n${n||``}`.trim()]:i(n)&&(p=[c(n,p[0]??{})]))}}let m=p.filter(e=>a(e));if(m.length>0){let e;for(let t of m)e=n(t,e??{});return e}}}export{l as callHook};
1
+ import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{createDefu as t,defu as n}from"defu";import{isFunction as r}from"@stryke/type-checks/is-function";import{isObject as i}from"@stryke/type-checks/is-object";import{isSet as a}from"@stryke/type-checks/is-set";import{isString as o}from"@stryke/type-checks/is-string";import s from"chalk";const c=t((e,t,n)=>o(e[t])&&o(n)?(e[t]=`${e[t]||``}\n${n||``}`.trim(),!0):!1);async function l(t,l,u,...d){let f=t.selectHooks(l,u);if(f.length>0){t.log(e.DEBUG,` ๐Ÿงฉ Calling plugin hook: ${s.bold.cyanBright(`${l}${u?.order?` (${u.order})`:``}`)}`);let p=[];if(u?.sequential===!1)p=await Promise.all(f.map(async e=>{if(!r(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);return Promise.resolve(e.handle.apply(e.context,[...d]))}));else for(let e of f){if(!r(e.handle))throw Error(`Plugin hook handler for hook "${l}" is not a function.`);if(u?.result===`first`||u?.asNextParam===!1){if(p.push(await Promise.resolve(e.handle.apply(e.context,[...d]))),u?.result===`first`&&a(p[p.length-1]))break}else{let t=[...d];p.length>0&&t.length>0&&(t[0]=r(u.asNextParam)?await Promise.resolve(u.asNextParam(p[0])):p[0]);let n=await Promise.resolve(e.handle.apply(e.context,[...t]));n&&(u?.result===`last`?p=[n]:o(n)?p=[`${o(p[0])&&p[0]||``}\n${n||``}`.trim()]:i(n)&&(p=[c(n,p[0]??{})]))}}let m=p.filter(e=>a(e));if(m.length>0){let e;for(let t of m)e=n(t,e??{});return e}}}export{l as callHook};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../internal/helpers/environment.cjs`),n=require(`../config-file.cjs`),r=require(`./context.cjs`),i=require(`./environment-context.cjs`);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/convert/to-array`),s=require(`@stryke/fs/resolve`),c=require(`@stryke/type-checks/is-set-object`),l=require(`chalk`);l=e.__toESM(l);var u=class e extends r.PowerlinesContext{#e={};#t=[];#n;static async from(t,r){let i=new e(await n.loadWorkspaceConfig(t,r.root));await i.withUserConfig(r);let a=await(0,s.resolvePackage)(`powerlines`);if(!a)throw Error("Could not resolve `powerlines` package location.");return i.powerlinesPath=a,i}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(`engine`),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(e={}){await super.init(e),await Promise.all((0,o.toArray)(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>t.createEnvironment(e,this.config.userConfig)):t.createDefaultEnvironment(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await i.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig,this.config),(0,c.isSetObject)(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(e){let n;if(e&&(n=this.environments[e]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(a.LogLevelLabel.DEBUG,`Applying the only configured environment: ${l.default.bold.cyanBright(n?.environment.name)}`)),!n){if(e)throw Error(`Environment "${e}" not found.`);n=await this.in(t.createDefaultEnvironment(this.config.userConfig)),this.log(a.LogLevelLabel.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${l.default.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}async toEnvironment(){let e;return Object.keys(this.environments).length>1?(e=await this.in(t.createEnvironment(t.GLOBAL_ENVIRONMENT,this.config.userConfig)),this.log(a.LogLevelLabel.DEBUG,`Combined all ${Object.keys(this.environments).length} environments into a single global context.`)):e=await this.getEnvironment(),e}};exports.PowerlinesAPIContext=u;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../internal/helpers/environment.cjs`),n=require(`../config-file.cjs`),r=require(`./context.cjs`),i=require(`./environment-context.cjs`);let a=require(`@storm-software/config-tools/types`),o=require(`@stryke/convert/to-array`),s=require(`@stryke/fs/resolve`),c=require(`@stryke/type-checks/is-set-object`),l=require(`chalk`);l=e.__toESM(l);var u=class e extends r.PowerlinesContext{#e={};#t=[];#n;static async from(t,r){let i=new e(await n.loadWorkspaceConfig(t,r.root));await i.withUserConfig(r);let a=await(0,s.resolvePackage)(`powerlines`);if(!a)throw Error("Could not resolve `powerlines` package location.");return i.powerlinesPath=a,i}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(e={}){await super.init(e),await Promise.all((0,o.toArray)(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>t.createEnvironment(e,this.config.userConfig)):t.createDefaultEnvironment(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await i.PowerlinesEnvironmentContext.fromConfig(this.workspaceConfig,this.config),(0,c.isSetObject)(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(e){let n;if(e&&(n=this.environments[e]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(a.LogLevelLabel.DEBUG,`Applying the only configured environment: ${l.default.bold.cyanBright(n?.environment.name)}`)),!n){if(e)throw Error(`Environment "${e}" not found.`);n=await this.in(t.createDefaultEnvironment(this.config.userConfig)),this.log(a.LogLevelLabel.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${l.default.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}async toEnvironment(){let e;return Object.keys(this.environments).length>1?(e=await this.in(t.createEnvironment(t.GLOBAL_ENVIRONMENT,this.config.userConfig)),this.log(a.LogLevelLabel.DEBUG,`Combined all ${Object.keys(this.environments).length} environments into a single global context.`)):e=await this.getEnvironment(),e}};exports.PowerlinesAPIContext=u;
@@ -1 +1 @@
1
- import{GLOBAL_ENVIRONMENT as e,createDefaultEnvironment as t,createEnvironment as n}from"../../internal/helpers/environment.mjs";import{loadWorkspaceConfig as r}from"../config-file.mjs";import{PowerlinesContext as i}from"./context.mjs";import{PowerlinesEnvironmentContext as a}from"./environment-context.mjs";import{LogLevelLabel as o}from"@storm-software/config-tools/types";import{toArray as s}from"@stryke/convert/to-array";import{resolvePackage as c}from"@stryke/fs/resolve";import{isSetObject as l}from"@stryke/type-checks/is-set-object";import u from"chalk";var d=class d extends i{#e={};#t=[];#n;static async from(e,t){let n=new d(await r(e,t.root));await n.withUserConfig(t);let i=await c(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=i,n}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(`engine`),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(e={}){await super.init(e),await Promise.all(s(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>n(e,this.config.userConfig)):t(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await a.fromConfig(this.workspaceConfig,this.config),l(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(e){let n;if(e&&(n=this.environments[e]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(o.DEBUG,`Applying the only configured environment: ${u.bold.cyanBright(n?.environment.name)}`)),!n){if(e)throw Error(`Environment "${e}" not found.`);n=await this.in(t(this.config.userConfig)),this.log(o.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${u.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}async toEnvironment(){let t;return Object.keys(this.environments).length>1?(t=await this.in(n(e,this.config.userConfig)),this.log(o.DEBUG,`Combined all ${Object.keys(this.environments).length} environments into a single global context.`)):t=await this.getEnvironment(),t}};export{d as PowerlinesAPIContext};
1
+ import{GLOBAL_ENVIRONMENT as e,createDefaultEnvironment as t,createEnvironment as n}from"../../internal/helpers/environment.mjs";import{loadWorkspaceConfig as r}from"../config-file.mjs";import{PowerlinesContext as i}from"./context.mjs";import{PowerlinesEnvironmentContext as a}from"./environment-context.mjs";import{LogLevelLabel as o}from"@storm-software/config-tools/types";import{toArray as s}from"@stryke/convert/to-array";import{resolvePackage as c}from"@stryke/fs/resolve";import{isSetObject as l}from"@stryke/type-checks/is-set-object";import u from"chalk";var d=class d extends i{#e={};#t=[];#n;static async from(e,t){let n=new d(await r(e,t.root));await n.withUserConfig(t);let i=await c(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=i,n}get $$internal(){return super.$$internal}set $$internal(e){super.$$internal=e;for(let e of Object.values(this.environments))e.$$internal=super.$$internal}get environments(){return this.#e}get log(){return this.#n||=this.createLog(),this.#n}get plugins(){return this.#t}constructor(e){super(e)}async init(e={}){await super.init(e),await Promise.all(s(this.config.userConfig.environments&&Object.keys(this.config.userConfig.environments).length>0?Object.keys(this.config.userConfig.environments).map(e=>n(e,this.config.userConfig)):t(this.config.userConfig)).map(async e=>{this.#e[e.name]=await this.in(e)}))}async in(e){let t;t=this.environments[e.name]?this.environments[e.name]:await a.fromConfig(this.workspaceConfig,this.config),l(this.config.inlineConfig)&&await t.withInlineConfig(this.config.inlineConfig),t.environment=e,t.plugins=[];for(let e of this.plugins)await t.addPlugin(e);return t}async withUserConfig(e,t={isHighPriority:!0}){await super.withUserConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withUserConfig(e,t)}))}async withInlineConfig(e,t={isHighPriority:!0}){await super.withInlineConfig(e,t),await Promise.all(Object.keys(this.#e).map(async n=>{await this.#e[n].withInlineConfig(e,t)}))}async addPlugin(e){this.plugins.push(e),await Promise.all(Object.keys(this.environments).map(async t=>{await this.environments[t].addPlugin(e)}))}async getEnvironment(e){let n;if(e&&(n=this.environments[e]),Object.keys(this.environments).length===1&&(n=this.environments[Object.keys(this.environments)[0]],this.log(o.DEBUG,`Applying the only configured environment: ${u.bold.cyanBright(n?.environment.name)}`)),!n){if(e)throw Error(`Environment "${e}" not found.`);n=await this.in(t(this.config.userConfig)),this.log(o.WARN,`No environment specified, and no default environment found. Using a temporary default environment: ${u.bold.cyanBright(n?.environment.name)}`)}return n}async getEnvironmentSafe(e){try{return await this.getEnvironment(e)}catch{return}}async toEnvironment(){let t;return Object.keys(this.environments).length>1?(t=await this.in(n(e,this.config.userConfig)),this.log(o.DEBUG,`Combined all ${Object.keys(this.environments).length} environments into a single global context.`)):t=await this.getEnvironment(),t}};export{d as PowerlinesAPIContext};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../plugin-utils/helpers.cjs`),n=require(`./context.cjs`),r=require(`../../types/plugin.cjs`),i=require(`./plugin-context.cjs`);let a=require(`@stryke/fs/resolve`),o=require(`@stryke/type-checks/is-function`),s=require(`@stryke/type-checks/is-object`);var c=class e extends n.PowerlinesContext{#e={};static async fromConfig(t,n){let r=new e(n,t);await r.init();let i=await(0,a.resolvePackage)(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return r.powerlinesPath=i,r}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(e){let n=e;if((0,o.isFunction)(e.applyToEnvironment)){let r=await Promise.resolve(e.applyToEnvironment(this.environment));if(!r||(0,s.isObject)(r)&&Object.keys(r).length===0)return;if(t.isPluginConfig(r))return this.$$internal.addPlugin(r);n=t.isPlugin(r)?r:e}let a=i.createPluginContext(n,this);this.plugins.push({plugin:n,context:a}),this.#e=Object.keys(n).filter(e=>!r.PLUGIN_NON_HOOK_FIELDS.includes(e)).reduce((e,r)=>{let i=r,s=n[i];if(!t.isPluginHook(s))return e;if(t.isHookExternal(i))e[i]??=[],e[i].push({plugin:n,hook:t.getHookHandler(s).bind(a)});else{if(e[i]??={},n.enforce)return e[i][`${n.enforce}Enforced`]??=[],t.addPluginHook(a,n,s,e[i][`${n.enforce}Enforced`]),e;if((0,o.isFunction)(s)||!s.order)return e[i].normal??=[],t.addPluginHook(a,n,s,e[i].normal),e;e[i][`${s.order}Ordered`]??=[],t.addPluginHook(a,n,s,e[i][`${s.order}Ordered`])}return e},this.hooks)}selectHooks(e,n){let r=[];if(this.hooks[e])if(t.isHookExternal(e))r.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let t=this.hooks[e];n?.order?n?.order===`pre`?(r.push(...(t.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(t.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):n?.order===`post`?(r.push(...(t.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(t.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):r.push(...(t.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(r.push(...this.selectHooks(e,{order:`pre`})),r.push(...this.selectHooks(e,{order:`normal`})),r.push(...this.selectHooks(e,{order:`post`})))}return r}constructor(e,t){super(t),this.resolvedConfig=e}};exports.PowerlinesEnvironmentContext=c;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`),t=require(`../../types/plugin.cjs`),n=require(`../../plugin-utils/helpers.cjs`),r=require(`./context.cjs`),i=require(`./plugin-context.cjs`);let a=require(`@stryke/fs/resolve`),o=require(`@stryke/type-checks/is-function`),s=require(`@stryke/type-checks/is-object`);var c=class e extends r.PowerlinesContext{#e={};static async fromConfig(t,n){let r=new e(n,t);await r.init();let i=await(0,a.resolvePackage)(`powerlines`);if(!i)throw Error("Could not resolve `powerlines` package location.");return r.powerlinesPath=i,r}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(e){let r=e;if((0,o.isFunction)(e.applyToEnvironment)){let t=await Promise.resolve(e.applyToEnvironment(this.environment));if(!t||(0,s.isObject)(t)&&Object.keys(t).length===0)return;if(n.isPluginConfig(t))return this.$$internal.addPlugin(t);r=n.isPlugin(t)?t:e}let a=i.createPluginContext(r,this);this.plugins.push({plugin:r,context:a}),this.#e=Object.keys(r).filter(e=>!t.PLUGIN_NON_HOOK_FIELDS.includes(e)).reduce((e,t)=>{let i=t,s=r[i];if(!n.isPluginHook(s))return e;if(n.isHookExternal(i))e[i]??=[],e[i].push({plugin:r,hook:n.getHookHandler(s).bind(a)});else{if(e[i]??={},r.enforce)return e[i][`${r.enforce}Enforced`]??=[],n.addPluginHook(a,r,s,e[i][`${r.enforce}Enforced`]),e;if((0,o.isFunction)(s)||!s.order)return e[i].normal??=[],n.addPluginHook(a,r,s,e[i].normal),e;e[i][`${s.order}Ordered`]??=[],n.addPluginHook(a,r,s,e[i][`${s.order}Ordered`])}return e},this.hooks)}selectHooks(e,t){let r=[];if(this.hooks[e])if(n.isHookExternal(e))r.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let n=this.hooks[e];t?.order?t?.order===`pre`?(r.push(...(n.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):t?.order===`post`?(r.push(...(n.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):r.push(...(n.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(r.push(...this.selectHooks(e,{order:`pre`})),r.push(...this.selectHooks(e,{order:`normal`})),r.push(...this.selectHooks(e,{order:`post`})))}return r}constructor(e,t){super(t),this.resolvedConfig=e}};exports.PowerlinesEnvironmentContext=c;
@@ -1 +1 @@
1
- import{addPluginHook as e,getHookHandler as t,isHookExternal as n,isPlugin as r,isPluginConfig as i,isPluginHook as a}from"../../plugin-utils/helpers.mjs";import{PowerlinesContext as o}from"./context.mjs";import{PLUGIN_NON_HOOK_FIELDS as s}from"../../types/plugin.mjs";import{createPluginContext as c}from"./plugin-context.mjs";import{resolvePackage as l}from"@stryke/fs/resolve";import{isFunction as u}from"@stryke/type-checks/is-function";import{isObject as d}from"@stryke/type-checks/is-object";var f=class f extends o{#e={};static async fromConfig(e,t){let n=new f(t,e);await n.init();let r=await l(`powerlines`);if(!r)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=r,n}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(o){let l=o;if(u(o.applyToEnvironment)){let e=await Promise.resolve(o.applyToEnvironment(this.environment));if(!e||d(e)&&Object.keys(e).length===0)return;if(i(e))return this.$$internal.addPlugin(e);l=r(e)?e:o}let f=c(l,this);this.plugins.push({plugin:l,context:f}),this.#e=Object.keys(l).filter(e=>!s.includes(e)).reduce((r,i)=>{let o=i,s=l[o];if(!a(s))return r;if(n(o))r[o]??=[],r[o].push({plugin:l,hook:t(s).bind(f)});else{if(r[o]??={},l.enforce)return r[o][`${l.enforce}Enforced`]??=[],e(f,l,s,r[o][`${l.enforce}Enforced`]),r;if(u(s)||!s.order)return r[o].normal??=[],e(f,l,s,r[o].normal),r;r[o][`${s.order}Ordered`]??=[],e(f,l,s,r[o][`${s.order}Ordered`])}return r},this.hooks)}selectHooks(e,t){let r=[];if(this.hooks[e])if(n(e))r.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let n=this.hooks[e];t?.order?t?.order===`pre`?(r.push(...(n.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):t?.order===`post`?(r.push(...(n.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),r.push(...(n.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):r.push(...(n.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(r.push(...this.selectHooks(e,{order:`pre`})),r.push(...this.selectHooks(e,{order:`normal`})),r.push(...this.selectHooks(e,{order:`post`})))}return r}constructor(e,t){super(t),this.resolvedConfig=e}};export{f as PowerlinesEnvironmentContext};
1
+ import{PLUGIN_NON_HOOK_FIELDS as e}from"../../types/plugin.mjs";import{addPluginHook as t,getHookHandler as n,isHookExternal as r,isPlugin as i,isPluginConfig as a,isPluginHook as o}from"../../plugin-utils/helpers.mjs";import{PowerlinesContext as s}from"./context.mjs";import{createPluginContext as c}from"./plugin-context.mjs";import{resolvePackage as l}from"@stryke/fs/resolve";import{isFunction as u}from"@stryke/type-checks/is-function";import{isObject as d}from"@stryke/type-checks/is-object";var f=class f extends s{#e={};static async fromConfig(e,t){let n=new f(t,e);await n.init();let r=await l(`powerlines`);if(!r)throw Error("Could not resolve `powerlines` package location.");return n.powerlinesPath=r,n}environment;plugins=[];get config(){return super.config}get hooks(){return this.#e}async addPlugin(s){let l=s;if(u(s.applyToEnvironment)){let e=await Promise.resolve(s.applyToEnvironment(this.environment));if(!e||d(e)&&Object.keys(e).length===0)return;if(a(e))return this.$$internal.addPlugin(e);l=i(e)?e:s}let f=c(l,this);this.plugins.push({plugin:l,context:f}),this.#e=Object.keys(l).filter(t=>!e.includes(t)).reduce((e,i)=>{let a=i,s=l[a];if(!o(s))return e;if(r(a))e[a]??=[],e[a].push({plugin:l,hook:n(s).bind(f)});else{if(e[a]??={},l.enforce)return e[a][`${l.enforce}Enforced`]??=[],t(f,l,s,e[a][`${l.enforce}Enforced`]),e;if(u(s)||!s.order)return e[a].normal??=[],t(f,l,s,e[a].normal),e;e[a][`${s.order}Ordered`]??=[],t(f,l,s,e[a][`${s.order}Ordered`])}return e},this.hooks)}selectHooks(e,t){let n=[];if(this.hooks[e])if(r(e))n.push(...this.hooks[e].map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}));else{let r=this.hooks[e];t?.order?t?.order===`pre`?(n.push(...(r.preOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),n.push(...(r.preEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):t?.order===`post`?(n.push(...(r.postOrdered??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})),n.push(...(r.postEnforced??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}}))):n.push(...(r.normal??[]).map(e=>{let t=this.plugins.find(t=>t.plugin.name===e.plugin.name);if(!t)throw Error(`Could not find plugin context for plugin "${e.plugin.name}".`);return{handle:e.handler,context:t.context}})):(n.push(...this.selectHooks(e,{order:`pre`})),n.push(...this.selectHooks(e,{order:`normal`})),n.push(...this.selectHooks(e,{order:`post`})))}return n}constructor(e,t){super(t),this.resolvedConfig=e}};export{f as PowerlinesEnvironmentContext};
@@ -1 +1 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`chalk`);n=e.__toESM(n);let r=require(`@stryke/string-format/title-case`),i=require(`@storm-software/config-tools/logger`),a=require(`@storm-software/config-tools/utilities/colors`),o=require(`@stryke/helpers/noop`);const s=(e,r={})=>{let s=r.logLevel===null?t.LogLevelLabel.SILENT:r.logLevel||t.LogLevelLabel.INFO;return s===t.LogLevelLabel.SILENT?o.noop:r.customLogger?r.customLogger:(t,...o)=>(0,i.getLogFn)((0,i.getLogLevel)(t),{...r,logLevel:s})(`${n.default.bold.hex((0,a.getColor)(`brand`,r))(`powerlines${e?`:${e}`:``}${r.name?` ${n.default.gray(`> `)}${r.name}`:``} ${n.default.gray(`> `)}`)}${o.join(` `)} `.trim())},c=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`],l=(e,t)=>(i,...a)=>e(i,` ${n.default.inverse.hex(c[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%c.length]||c[0])(` ${(0,r.titleCase)(t)} `)} ${a.join(` `)} `);exports.createLog=s,exports.extendLog=l;
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`chalk`);n=e.__toESM(n);let r=require(`@stryke/string-format/title-case`),i=require(`@storm-software/config-tools/logger`),a=require(`@storm-software/config-tools/utilities/colors`),o=require(`@stryke/helpers/noop`),s=require(`@stryke/string-format/kebab-case`);const c=(e,r={})=>{let c=r.logLevel===null?t.LogLevelLabel.SILENT:r.logLevel||t.LogLevelLabel.INFO;return c===t.LogLevelLabel.SILENT?o.noop:r.customLogger?r.customLogger:(t,...o)=>(0,i.getLogFn)((0,i.getLogLevel)(t),{...r,logLevel:c})(`${n.default.bold.hex((0,a.getColor)(`brand`,r))(`${e?(0,s.kebabCase)(e):``}${r.name?`${e?n.default.gray(` > `):``}${(0,s.kebabCase)(r.name)}`:``}${n.default.gray(` > `)}`)}${o.join(` `)} `.trim())},l=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],u=(e,t)=>(i,...a)=>e(i,` ${n.default.inverse.hex(l[t.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%l.length]||l[0])(` ${(0,r.titleCase)(t)} `)} ${a.join(` `)} `);exports.createLog=c,exports.extendLog=u;
@@ -1 +1 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import t from"chalk";import{titleCase as n}from"@stryke/string-format/title-case";import{getLogFn as r,getLogLevel as i}from"@storm-software/config-tools/logger";import{getColor as a}from"@storm-software/config-tools/utilities/colors";import{noop as o}from"@stryke/helpers/noop";const s=(n,s={})=>{let c=s.logLevel===null?e.SILENT:s.logLevel||e.INFO;return c===e.SILENT?o:s.customLogger?s.customLogger:(e,...o)=>r(i(e),{...s,logLevel:c})(`${t.bold.hex(a(`brand`,s))(`powerlines${n?`:${n}`:``}${s.name?` ${t.gray(`> `)}${s.name}`:``} ${t.gray(`> `)}`)}${o.join(` `)} `.trim())},c=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`],l=(e,r)=>(i,...a)=>e(i,` ${t.inverse.hex(c[r.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%c.length]||c[0])(` ${n(r)} `)} ${a.join(` `)} `);export{s as createLog,l as extendLog};
1
+ import{LogLevelLabel as e}from"@storm-software/config-tools/types";import t from"chalk";import{titleCase as n}from"@stryke/string-format/title-case";import{getLogFn as r,getLogLevel as i}from"@storm-software/config-tools/logger";import{getColor as a}from"@storm-software/config-tools/utilities/colors";import{noop as o}from"@stryke/helpers/noop";import{kebabCase as s}from"@stryke/string-format/kebab-case";const c=(n,c={})=>{let l=c.logLevel===null?e.SILENT:c.logLevel||e.INFO;return l===e.SILENT?o:c.customLogger?c.customLogger:(e,...o)=>r(i(e),{...c,logLevel:l})(`${t.bold.hex(a(`brand`,c))(`${n?s(n):``}${c.name?`${n?t.gray(` > `):``}${s(c.name)}`:``}${t.gray(` > `)}`)}${o.join(` `)} `.trim())},l=[`#00A0DD`,`#6FCE4E`,`#FBBF24`,`#F43F5E`,`#3B82F6`,`#A855F7`,`#469592`,`#288EDF`,`#D8B4FE`,`#10B981`,`#EF4444`,`#F0EC56`,`#F472B6`,`#22D3EE`,`#EAB308`,`#84CC16`,`#F87171`,`#0EA5E9`,`#D946EF`,`#FACC15`,`#34D399`,`#8B5CF6`],u=(e,r)=>(i,...a)=>e(i,` ${t.inverse.hex(l[r.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>e+t,0)%l.length]||l[0])(` ${n(r)} `)} ${a.join(` `)} `);export{c as createLog,u as extendLog};
@@ -1 +1 @@
1
- const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@stryke/path/join-paths`),r=require(`@stryke/fs/list-files`),i=require(`@stryke/fs/json`),a=require(`@stryke/path/file-path-fns`),o=require(`@stryke/fs/exists`),s=require(`@stryke/helpers/get-unique`);require(`@stryke/fs/remove-file`);let c=require(`@stryke/string-format/kebab-case`);const l=45,u=62;function d(e,t){let n=`${(0,c.kebabCase)(e)}_${t}`;return n.length>45?n.slice(0,45):n}async function f(e){let r=(0,n.joinPaths)(e.dataPath,`meta.json`);e.log(t.LogLevelLabel.DEBUG,`Writing runtime metadata to ${r}`),await e.fs.write(r,JSON.stringify(e.meta,null,2))}exports.CACHE_HASH_LENGTH=62,exports.PROJECT_ROOT_HASH_LENGTH=45,exports.getPrefixedProjectRootHash=d,exports.writeMetaFile=f;
1
+ const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@stryke/path/join-paths`),r=require(`@stryke/fs/list-files`),i=require(`@stryke/fs/json`),a=require(`@stryke/path/file-path-fns`),o=require(`@stryke/fs/exists`),s=require(`@stryke/helpers/get-unique`),c=require(`@stryke/string-format/kebab-case`);require(`@stryke/fs/remove-file`);const l=45,u=62;function d(e,t){let n=`${(0,c.kebabCase)(e)}_${t}`;return n.length>45?n.slice(0,45):n}async function f(e){let r=(0,n.joinPaths)(e.dataPath,`meta.json`);e.log(t.LogLevelLabel.DEBUG,`Writing runtime metadata to ${r}`),await e.fs.write(r,JSON.stringify(e.meta,null,2))}exports.CACHE_HASH_LENGTH=62,exports.PROJECT_ROOT_HASH_LENGTH=45,exports.getPrefixedProjectRootHash=d,exports.writeMetaFile=f;
@@ -1 +1 @@
1
- import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{joinPaths as t}from"@stryke/path/join-paths";import{listFiles as n}from"@stryke/fs/list-files";import{readJsonFile as r}from"@stryke/fs/json";import{hasFileExtension as i}from"@stryke/path/file-path-fns";import{existsSync as a}from"@stryke/fs/exists";import{getUnique as o}from"@stryke/helpers/get-unique";import"@stryke/fs/remove-file";import{kebabCase as s}from"@stryke/string-format/kebab-case";const c=45,l=62;function u(e,t){let n=`${s(e)}_${t}`;return n.length>45?n.slice(0,45):n}async function d(n){let r=t(n.dataPath,`meta.json`);n.log(e.DEBUG,`Writing runtime metadata to ${r}`),await n.fs.write(r,JSON.stringify(n.meta,null,2))}export{l as CACHE_HASH_LENGTH,c as PROJECT_ROOT_HASH_LENGTH,u as getPrefixedProjectRootHash,d as writeMetaFile};
1
+ import{LogLevelLabel as e}from"@storm-software/config-tools/types";import{joinPaths as t}from"@stryke/path/join-paths";import{listFiles as n}from"@stryke/fs/list-files";import{readJsonFile as r}from"@stryke/fs/json";import{hasFileExtension as i}from"@stryke/path/file-path-fns";import{existsSync as a}from"@stryke/fs/exists";import{getUnique as o}from"@stryke/helpers/get-unique";import{kebabCase as s}from"@stryke/string-format/kebab-case";import"@stryke/fs/remove-file";const c=45,l=62;function u(e,t){let n=`${s(e)}_${t}`;return n.length>45?n.slice(0,45):n}async function d(n){let r=t(n.dataPath,`meta.json`);n.log(e.DEBUG,`Writing runtime metadata to ${r}`),await n.fs.write(r,JSON.stringify(n.meta,null,2))}export{l as CACHE_HASH_LENGTH,c as PROJECT_ROOT_HASH_LENGTH,u as getPrefixedProjectRootHash,d as writeMetaFile};
@@ -1 +1 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../types/commands.cjs`);let n=require(`@stryke/type-checks/is-function`),r=require(`@stryke/type-checks/is-set-object`),i=require(`@stryke/type-checks/is-set-string`),a=require(`@stryke/type-checks/is-undefined`);function o(e){return(0,r.isSetObject)(e)&&`name`in e&&(0,i.isSetString)(e.name)&&((0,a.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,n.isFunction)(e.applyToEnvironment))&&((0,a.isUndefined)(e.dedupe)||`dedupe`in e&&(0,n.isFunction)(e.dedupe))&&t.SUPPORTED_COMMANDS.every(t=>(0,a.isUndefined)(e[t])||t in e&&((0,n.isFunction)(e[t])||(0,r.isSetObject)(e[t])&&`handler`in e[t]&&(0,n.isFunction)(e[t].handler)))}function s(e){return(0,r.isSetObject)(e)&&`plugin`in e&&(((0,i.isSetString)(e.plugin)||(0,n.isFunction)(e.plugin))&&`options`in e&&(0,r.isSetObject)(e.options)||o(e.plugin))}function c(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&(((0,i.isSetString)(e[0])||(0,n.isFunction)(e[0]))&&e.length>1&&(0,r.isSetObject)(e[1])||o(e[0]))}function l(e){return(0,i.isSetString)(e)||(0,n.isFunction)(e)||o(e)||Array.isArray(e)&&e.every(e=>o(e))||s(e)||c(e)}function u(e){return(0,n.isFunction)(e)||(0,r.isSetObject)(e)&&`handler`in e&&(0,n.isFunction)(e.handler)}function d(e){return(0,r.isSetObject)(e)&&`handler`in e&&(0,n.isFunction)(e.handler)}function f(e){return u(e)||d(e)}function p(e){return(0,n.isFunction)(e)?e:e.handler}function m(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function h(e,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&((0,n.isFunction)(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function g(e,t,r,i){h(t,i.map(e=>e.plugin))||i.push((0,n.isFunction)(r)?{plugin:t,handler:p(r).bind(e)}:{plugin:t,...r,handler:p(r).bind(e)})}exports.addPluginHook=g,exports.checkDedupe=h,exports.getHookHandler=p,exports.isHookExternal=m,exports.isPlugin=o,exports.isPluginConfig=l,exports.isPluginConfigObject=s,exports.isPluginConfigTuple=c,exports.isPluginHook=f;
1
+ const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../types/build.cjs`),n=require(`../types/plugin.cjs`);let r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/type-checks/is-set-string`),o=require(`@stryke/type-checks/is-undefined`);function s(e){return(0,i.isSetObject)(e)&&`name`in e&&(0,a.isSetString)(e.name)&&((0,o.isUndefined)(e.api)||`api`in e&&(0,i.isSetObject)(e.api))&&((0,o.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,r.isFunction)(e.applyToEnvironment))&&((0,o.isUndefined)(e.dedupe)||`dedupe`in e&&(0,r.isFunction)(e.dedupe))&&n.KNOWN_HOOKS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(f(e[t])||t===`config`&&(0,i.isSetObject)(e[t])))&&t.UNPLUGIN_BUILD_VARIANTS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(0,i.isSetObject)(e[t]))}function c(e){return(0,i.isSetObject)(e)&&`plugin`in e&&(((0,a.isSetString)(e.plugin)||(0,r.isFunction)(e.plugin))&&`options`in e&&(0,i.isSetObject)(e.options)||s(e.plugin))}function l(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&(((0,a.isSetString)(e[0])||(0,r.isFunction)(e[0]))&&e.length>1&&(0,i.isSetObject)(e[1])||s(e[0]))}function u(e){return(0,a.isSetString)(e)||(0,r.isFunction)(e)||s(e)||c(e)||l(e)||Array.isArray(e)&&e.every(e=>u(e))}function d(e){return(0,i.isSetObject)(e)&&`handler`in e&&(0,r.isFunction)(e.handler)}function f(e){return(0,r.isFunction)(e)||d(e)}function p(e){return f(e)||d(e)}function m(e){return(0,r.isFunction)(e)?e:e.handler}function h(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function g(e,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&((0,r.isFunction)(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function _(e,t,n,i){g(t,i.map(e=>e.plugin))||i.push((0,r.isFunction)(n)?{plugin:t,handler:m(n).bind(e)}:{plugin:t,...n,handler:m(n).bind(e)})}function v(e){if(u(e))return null;if(Array.isArray(e)){let t=[];return e.forEach(e=>{let n=v(e);n&&t.push(...n.map(e=>JSON.stringify(e,null,2)))}),t.length>0?t:null}return[JSON.stringify(e,null,2)]}exports.addPluginHook=_,exports.checkDedupe=g,exports.findInvalidPluginConfig=v,exports.getHookHandler=m,exports.isHookExternal=h,exports.isPlugin=s,exports.isPluginConfig=u,exports.isPluginConfigObject=c,exports.isPluginConfigTuple=l,exports.isPluginHook=p;
@@ -1 +1 @@
1
- import{SUPPORTED_COMMANDS as e}from"../types/commands.mjs";import{isFunction as t}from"@stryke/type-checks/is-function";import{isSetObject as n}from"@stryke/type-checks/is-set-object";import{isSetString as r}from"@stryke/type-checks/is-set-string";import{isUndefined as i}from"@stryke/type-checks/is-undefined";function a(a){return n(a)&&`name`in a&&r(a.name)&&(i(a.applyToEnvironment)||`applyToEnvironment`in a&&t(a.applyToEnvironment))&&(i(a.dedupe)||`dedupe`in a&&t(a.dedupe))&&e.every(e=>i(a[e])||e in a&&(t(a[e])||n(a[e])&&`handler`in a[e]&&t(a[e].handler)))}function o(e){return n(e)&&`plugin`in e&&((r(e.plugin)||t(e.plugin))&&`options`in e&&n(e.options)||a(e.plugin))}function s(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&((r(e[0])||t(e[0]))&&e.length>1&&n(e[1])||a(e[0]))}function c(e){return r(e)||t(e)||a(e)||Array.isArray(e)&&e.every(e=>a(e))||o(e)||s(e)}function l(e){return t(e)||n(e)&&`handler`in e&&t(e.handler)}function u(e){return n(e)&&`handler`in e&&t(e.handler)}function d(e){return l(e)||u(e)}function f(e){return t(e)?e:e.handler}function p(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function m(e,n){return e.dedupe===!1||n.some(n=>n.dedupe!==!1&&(t(n.dedupe)&&n.dedupe(e)||n.name===e.name))}function h(e,n,r,i){m(n,i.map(e=>e.plugin))||i.push(t(r)?{plugin:n,handler:f(r).bind(e)}:{plugin:n,...r,handler:f(r).bind(e)})}export{h as addPluginHook,m as checkDedupe,f as getHookHandler,p as isHookExternal,a as isPlugin,c as isPluginConfig,o as isPluginConfigObject,s as isPluginConfigTuple,d as isPluginHook};
1
+ import{UNPLUGIN_BUILD_VARIANTS as e}from"../types/build.mjs";import{KNOWN_HOOKS as t}from"../types/plugin.mjs";import{isFunction as n}from"@stryke/type-checks/is-function";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{isSetString as i}from"@stryke/type-checks/is-set-string";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(o){return r(o)&&`name`in o&&i(o.name)&&(a(o.api)||`api`in o&&r(o.api))&&(a(o.applyToEnvironment)||`applyToEnvironment`in o&&n(o.applyToEnvironment))&&(a(o.dedupe)||`dedupe`in o&&n(o.dedupe))&&t.every(e=>a(o[e])||e in o&&(d(o[e])||e===`config`&&r(o[e])))&&e.every(e=>a(o[e])||e in o&&r(o[e]))}function s(e){return r(e)&&`plugin`in e&&((i(e.plugin)||n(e.plugin))&&`options`in e&&r(e.options)||o(e.plugin))}function c(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&((i(e[0])||n(e[0]))&&e.length>1&&r(e[1])||o(e[0]))}function l(e){return i(e)||n(e)||o(e)||s(e)||c(e)||Array.isArray(e)&&e.every(e=>l(e))}function u(e){return r(e)&&`handler`in e&&n(e.handler)}function d(e){return n(e)||u(e)}function f(e){return d(e)||u(e)}function p(e){return n(e)?e:e.handler}function m(e){return e.startsWith(`vite:`)||e.startsWith(`esbuild:`)||e.startsWith(`rolldown:`)||e.startsWith(`rollup:`)||e.startsWith(`webpack:`)||e.startsWith(`rspack:`)||e.startsWith(`farm:`)}function h(e,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&(n(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function g(e,t,r,i){h(t,i.map(e=>e.plugin))||i.push(n(r)?{plugin:t,handler:p(r).bind(e)}:{plugin:t,...r,handler:p(r).bind(e)})}function _(e){if(l(e))return null;if(Array.isArray(e)){let t=[];return e.forEach(e=>{let n=_(e);n&&t.push(...n.map(e=>JSON.stringify(e,null,2)))}),t.length>0?t:null}return[JSON.stringify(e,null,2)]}export{g as addPluginHook,h as checkDedupe,_ as findInvalidPluginConfig,p as getHookHandler,m as isHookExternal,o as isPlugin,l as isPluginConfig,s as isPluginConfigObject,c as isPluginConfigTuple,f as isPluginHook};
@@ -0,0 +1 @@
1
+ const e=[`rollup`,`webpack`,`rspack`,`vite`,`esbuild`,`farm`,`unloader`,`rolldown`];exports.UNPLUGIN_BUILD_VARIANTS=e;
@@ -0,0 +1 @@
1
+ const e=[`rollup`,`webpack`,`rspack`,`vite`,`esbuild`,`farm`,`unloader`,`rolldown`];export{e as UNPLUGIN_BUILD_VARIANTS};
@@ -36,7 +36,7 @@ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions
36
36
  /**
37
37
  * A configuration tuple for a Powerlines plugin.
38
38
  */
39
- type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Plugin<TContext>[] | Promise<Plugin<TContext> | Plugin<TContext>[]> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
39
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
40
40
  type ProjectType = "application" | "library";
41
41
  interface DeployConfig {
42
42
  /**
@@ -38,7 +38,7 @@ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions
38
38
  /**
39
39
  * A configuration tuple for a Powerlines plugin.
40
40
  */
41
- type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Plugin<TContext>[] | Promise<Plugin<TContext> | Plugin<TContext>[]> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
41
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
42
42
  type ProjectType = "application" | "library";
43
43
  interface DeployConfig {
44
44
  /**
@@ -1 +1 @@
1
- const e=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`];exports.PLUGIN_NON_HOOK_FIELDS=e;
1
+ const e=require(`./build.cjs`),t=require(`./commands.cjs`),n=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`],r=[...t.SUPPORTED_COMMANDS,`config`,`configEnvironment`,`configResolved`,`buildStart`,`buildEnd`,`transform`,`load`,`resolveId`,`writeBundle`],i=[...n,...r,...e.UNPLUGIN_BUILD_VARIANTS];exports.KNOWN_HOOKS=r,exports.PLUGIN_NON_HOOK_FIELDS=n;
@@ -1 +1 @@
1
- const e=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`];export{e as PLUGIN_NON_HOOK_FIELDS};
1
+ import{UNPLUGIN_BUILD_VARIANTS as e}from"./build.mjs";import{SUPPORTED_COMMANDS as t}from"./commands.mjs";const n=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`],r=[...t,`config`,`configEnvironment`,`configResolved`,`buildStart`,`buildEnd`,`transform`,`load`,`resolveId`,`writeBundle`];[...n,...r,...e];export{r as KNOWN_HOOKS,n as PLUGIN_NON_HOOK_FIELDS};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-rspack",
3
- "version": "0.5.111",
3
+ "version": "0.5.113",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to build projects using Webpack.",
6
6
  "repository": {
@@ -152,13 +152,13 @@
152
152
  "@stryke/types": "^0.10.28",
153
153
  "defu": "^6.1.4",
154
154
  "jiti": "^2.6.1",
155
- "powerlines": "^0.36.7"
155
+ "powerlines": "^0.36.9"
156
156
  },
157
157
  "devDependencies": {
158
- "@powerlines/nx": "^0.11.33",
159
- "@powerlines/plugin-plugin": "^0.12.54",
158
+ "@powerlines/nx": "^0.11.35",
159
+ "@powerlines/plugin-plugin": "^0.12.56",
160
160
  "@types/node": "^24.10.4"
161
161
  },
162
162
  "publishConfig": { "access": "public" },
163
- "gitHead": "abbf694ae460ab6f58ae645a000cabf4a4fdac80"
163
+ "gitHead": "e9fb959df894f1aa67074af9fbb126978a450a45"
164
164
  }