@powerlines/plugin-tsup 0.12.80 โ 0.12.81
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.
|
@@ -5,7 +5,7 @@ const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./internal/bab
|
|
|
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,g.listFiles)((0,p.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,p.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,g.listFiles)((0,p.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,p.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,g.listFiles)((0,p.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,p.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,p.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,p.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,A.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,f.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,p.joinPaths)((0,f.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);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,p.joinPaths)((0,m.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,p.joinPaths)((0,m.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,k.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;if(t.dependsOn)for(let e of t.dependsOn)await this.#i(e);this.context.log(d.LogLevelLabel.DEBUG,`Successfully initialized the ${j.default.bold.cyanBright(t.name)} plugin`),await this.context.addPlugin(t)}}async#a(e){let t=e;if((0,O.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(s.isPlugin(t))n=t;else if((0,T.isFunction)(t))n=await Promise.resolve(t());else if((0,_.isSetString)(t)){let e=await this.#o(t);n=(0,T.isFunction)(e)?await Promise.resolve(e()):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,_.isSetString)(e)){let t=await this.#o(e);n=(0,T.isFunction)(t)?await Promise.resolve(r?t(r):t()):t}else (0,T.isFunction)(e)?n=await Promise.resolve(e(r)):s.isPlugin(e)&&(n=e)}if(!n)throw Error(`The plugin configuration ${JSON.stringify(t)} is invalid. This configuration must point to a valid Powerlines plugin module.`);if(!s.isPlugin(n))throw Error(`The plugin option ${JSON.stringify(n)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);return s.checkDedupe(n,this.context.plugins)?(this.context.log(d.LogLevelLabel.TRACE,`Duplicate ${j.default.bold.cyanBright(n.name)} plugin dependency detected - Skipping initialization.`),null):(this.context.log(d.LogLevelLabel.TRACE,`Initializing the ${j.default.bold.cyanBright(n.name)} plugin...`),n)}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,S.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,x.install)(e,{cwd:this.context.config.projectRoot});if((0,E.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,p.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,g.listFiles)((0,p.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,p.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,g.listFiles)((0,p.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,p.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,g.listFiles)((0,p.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,p.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,p.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,p.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,A.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,f.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,p.joinPaths)((0,f.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,p.joinPaths)((0,m.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,p.joinPaths)((0,m.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,k.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;if(t.dependsOn)for(let e of t.dependsOn)await this.#i(e);this.context.log(d.LogLevelLabel.DEBUG,`Successfully initialized the ${j.default.bold.cyanBright(t.name)} plugin`),await this.context.addPlugin(t)}}async#a(e){let t=e;if((0,O.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(s.isPlugin(t))n=t;else if((0,T.isFunction)(t))n=await Promise.resolve(t());else if((0,_.isSetString)(t)){let e=await this.#o(t);n=(0,T.isFunction)(e)?await Promise.resolve(e()):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,_.isSetString)(e)){let t=await this.#o(e);n=(0,T.isFunction)(t)?await Promise.resolve(r?t(r):t()):t}else (0,T.isFunction)(e)?n=await Promise.resolve(e(r)):s.isPlugin(e)&&(n=e)}if(!n)throw Error(`The plugin configuration ${JSON.stringify(t)} is invalid. This configuration must point to a valid Powerlines plugin module.`);if(!s.isPlugin(n))throw Error(`The plugin option ${JSON.stringify(n)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);return s.checkDedupe(n,this.context.plugins)?(this.context.log(d.LogLevelLabel.TRACE,`Duplicate ${j.default.bold.cyanBright(n.name)} plugin dependency detected - Skipping initialization.`),null):(this.context.log(d.LogLevelLabel.TRACE,`Initializing the ${j.default.bold.cyanBright(n.name)} plugin...`),n)}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,S.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,x.install)(e,{cwd:this.context.config.projectRoot});if((0,E.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,p.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
9
|
${(0,w.isError)(n)?n.message:String(n)}
|
|
10
10
|
|
|
11
11
|
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"`)}}}};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-tsup",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.81",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
|
|
6
6
|
"repository": {
|
|
@@ -150,13 +150,13 @@
|
|
|
150
150
|
"@stryke/type-checks": "^0.5.11",
|
|
151
151
|
"@stryke/types": "^0.10.25",
|
|
152
152
|
"defu": "^6.1.4",
|
|
153
|
-
"powerlines": "^0.32.
|
|
153
|
+
"powerlines": "^0.32.2"
|
|
154
154
|
},
|
|
155
155
|
"devDependencies": {
|
|
156
|
-
"@powerlines/nx": "^0.11.
|
|
157
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
156
|
+
"@powerlines/nx": "^0.11.3",
|
|
157
|
+
"@powerlines/plugin-plugin": "^0.12.24",
|
|
158
158
|
"@types/node": "^24.10.4"
|
|
159
159
|
},
|
|
160
160
|
"publishConfig": { "access": "public" },
|
|
161
|
-
"gitHead": "
|
|
161
|
+
"gitHead": "cfee2e6d1e744dc328e57a623cb9ae6632616f90"
|
|
162
162
|
}
|