@powerlines/plugin-esbuild 0.13.110 โ 0.13.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/powerlines/src/api.cjs +1 -1
- package/dist/powerlines/src/plugin-utils/helpers.cjs +1 -1
- package/dist/powerlines/src/plugin-utils/helpers.mjs +1 -1
- package/dist/powerlines/src/types/config.d.mts +1 -0
- package/dist/powerlines/src/types/plugin.cjs +1 -1
- package/dist/powerlines/src/types/plugin.d.cts +2 -3
- package/dist/powerlines/src/types/plugin.d.mts +2 -3
- package/dist/powerlines/src/types/plugin.mjs +1 -1
- package/package.json +5 -5
|
@@ -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(_.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(_.LogLevelLabel.INFO,`๐ Creating a new Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.log(_.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.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,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}await this.callHook(`new`,{environment:e,order:`post`})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(_.LogLevelLabel.INFO,`๐งน Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#r(async e=>{this.context.log(_.LogLevelLabel.TRACE,`Cleaning the project's dist and artifacts directories.`),await e.fs.remove((0,d.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,d.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.artifactsPath)),await this.callHook(`clean`,{environment:e,sequential:!1})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(_.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(_.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(_.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(_.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(_.LogLevelLabel.INFO,`๐ Generating documentation for the Powerlines project`),await this.prepare(e),await this.#r(async t=>{t.log(_.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(_.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(_.LogLevelLabel.INFO,`๐ฆ Deploying the Powerlines project`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(_.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#r(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(_.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,h.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,d.joinPaths)((0,h.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);e.fs.existsSync(t)&&t!==n&&(e.log(_.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(_.LogLevelLabel.DEBUG,`Copying asset(s): ${j.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,d.joinPaths)((0,f.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,d.joinPaths)((0,f.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(_.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(_.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;for(let e of t)
|
|
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(_.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(_.LogLevelLabel.INFO,`๐ Creating a new Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.log(_.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.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,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,m.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(_.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=M.default.compile(n);await e.fs.write((0,d.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}await this.callHook(`new`,{environment:e,order:`post`})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(_.LogLevelLabel.INFO,`๐งน Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#r(async e=>{this.context.log(_.LogLevelLabel.TRACE,`Cleaning the project's dist and artifacts directories.`),await e.fs.remove((0,d.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.buildPath)),await e.fs.remove((0,d.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.output.artifactsPath)),await this.callHook(`clean`,{environment:e,sequential:!1})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(_.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(_.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(_.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(_.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(_.LogLevelLabel.INFO,`๐ Generating documentation for the Powerlines project`),await this.prepare(e),await this.#r(async t=>{t.log(_.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(_.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(_.LogLevelLabel.INFO,`๐ฆ Deploying the Powerlines project`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(_.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(_.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#r(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(_.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,h.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,d.joinPaths)((0,h.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);e.fs.existsSync(t)&&t!==n&&(e.log(_.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(_.LogLevelLabel.DEBUG,`Copying asset(s): ${j.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,d.joinPaths)((0,f.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${j.default.greenBright((0,d.joinPaths)((0,f.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(_.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(_.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;for(let e of t)this.context.log(_.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,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(Array.isArray(t)&&t.every(s.isPlugin))n=t;else if(s.isPlugin(t))n=[t];else if((0,T.isFunction)(t))n=(0,p.toArray)(await Promise.resolve(t()));else if((0,g.isSetString)(t)){let e=await this.#o(t);n=(0,T.isFunction)(e)?(0,p.toArray)(await Promise.resolve(e())):(0,p.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,g.isSetString)(e)){let t=await this.#o(e);n=(0,T.isFunction)(t)?(0,p.toArray)(await Promise.resolve(r?t(r):t())):(0,p.toArray)(t)}else (0,T.isFunction)(e)?n=(0,p.toArray)(await Promise.resolve(e(r))):Array.isArray(e)&&e.every(s.isPlugin)?n=e:s.isPlugin(e)&&(n=(0,p.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(_.LogLevelLabel.TRACE,`Duplicate ${j.default.bold.cyanBright(e.name)} plugin dependency detected - Skipping initialization.`):(r.push(e),this.context.log(_.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,S.isPackageExists)(e,{paths:[this.context.workspaceConfig.workspaceRoot,this.context.config.projectRoot]});if(!t&&this.context.config.skipInstalls!==!0){this.#e.log(_.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(_.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,d.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"`)}}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../types/commands.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/type-checks/is-undefined`);function o(e){return(0,i.isSetObject)(e)&&`name`in e&&(0,n.isSetString)(e.name)&&((0,a.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,r.isFunction)(e.applyToEnvironment))&&((0,a.isUndefined)(e.dedupe)||`dedupe`in e&&(0,r.isFunction)(e.dedupe))&&
|
|
1
|
+
const e=require(`../../../_virtual/rolldown_runtime.cjs`),t=require(`../types/commands.cjs`);let n=require(`@stryke/type-checks/is-set-string`),r=require(`@stryke/type-checks/is-function`),i=require(`@stryke/type-checks/is-set-object`),a=require(`@stryke/type-checks/is-undefined`);function o(e){return(0,i.isSetObject)(e)&&`name`in e&&(0,n.isSetString)(e.name)&&((0,a.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,r.isFunction)(e.applyToEnvironment))&&((0,a.isUndefined)(e.dedupe)||`dedupe`in e&&(0,r.isFunction)(e.dedupe))&&t.SUPPORTED_COMMANDS.every(t=>(0,a.isUndefined)(e[t])||t in e&&((0,r.isFunction)(e[t])||(0,i.isSetObject)(e[t])&&`handler`in e[t]&&(0,r.isFunction)(e[t].handler)))}function s(e){return(0,i.isSetObject)(e)&&`plugin`in e&&(((0,n.isSetString)(e.plugin)||(0,r.isFunction)(e.plugin))&&`options`in e&&(0,i.isSetObject)(e.options)||o(e.plugin))}function c(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&(((0,n.isSetString)(e[0])||(0,r.isFunction)(e[0]))&&e.length>1&&(0,i.isSetObject)(e[1])||o(e[0]))}function l(e){return(0,n.isSetString)(e)||(0,r.isFunction)(e)||o(e)||Array.isArray(e)&&e.every(e=>o(e))||s(e)||c(e)}function u(e){return(0,r.isFunction)(e)||(0,i.isSetObject)(e)&&`handler`in e&&(0,r.isFunction)(e.handler)}function d(e){return(0,i.isSetObject)(e)&&`handler`in e&&(0,r.isFunction)(e.handler)}function f(e){return u(e)||d(e)}function p(e){return(0,r.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,r.isFunction)(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function g(e,t,n,i){h(t,i.map(e=>e.plugin))||i.push((0,r.isFunction)(n)?{plugin:t,handler:p(n).bind(e)}:{plugin:t,...n,handler:p(n).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 +1 @@
|
|
|
1
|
-
import{SUPPORTED_COMMANDS as e}from"../types/commands.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{isFunction as n}from"@stryke/type-checks/is-function";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{isUndefined as i}from"@stryke/type-checks/is-undefined";function a(a){return r(a)&&`name`in a&&t(a.name)&&(i(a.applyToEnvironment)||`applyToEnvironment`in a&&n(a.applyToEnvironment))&&(i(a.dedupe)||`dedupe`in a&&n(a.dedupe))&&
|
|
1
|
+
import{SUPPORTED_COMMANDS as e}from"../types/commands.mjs";import{isSetString as t}from"@stryke/type-checks/is-set-string";import{isFunction as n}from"@stryke/type-checks/is-function";import{isSetObject as r}from"@stryke/type-checks/is-set-object";import{isUndefined as i}from"@stryke/type-checks/is-undefined";function a(a){return r(a)&&`name`in a&&t(a.name)&&(i(a.applyToEnvironment)||`applyToEnvironment`in a&&n(a.applyToEnvironment))&&(i(a.dedupe)||`dedupe`in a&&n(a.dedupe))&&e.every(e=>i(a[e])||e in a&&(n(a[e])||r(a[e])&&`handler`in a[e]&&n(a[e].handler)))}function o(e){return r(e)&&`plugin`in e&&((t(e.plugin)||n(e.plugin))&&`options`in e&&r(e.options)||a(e.plugin))}function s(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&((t(e[0])||n(e[0]))&&e.length>1&&r(e[1])||a(e[0]))}function c(e){return t(e)||n(e)||a(e)||Array.isArray(e)&&e.every(e=>a(e))||o(e)||s(e)}function l(e){return n(e)||r(e)&&`handler`in e&&n(e.handler)}function u(e){return r(e)&&`handler`in e&&n(e.handler)}function d(e){return l(e)||u(e)}function f(e){return n(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,t){return e.dedupe===!1||t.some(t=>t.dedupe!==!1&&(n(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function h(e,t,r,i){m(t,i.map(e=>e.plugin))||i.push(n(r)?{plugin:t,handler:f(r).bind(e)}:{plugin:t,...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};
|
|
@@ -6,6 +6,7 @@ import { TSConfig } from "./tsconfig.mjs";
|
|
|
6
6
|
import { PluginContext } from "./context.mjs";
|
|
7
7
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
8
8
|
import { transformAsync } from "@babel/core";
|
|
9
|
+
import "c12";
|
|
9
10
|
import { PreviewOptions } from "vite";
|
|
10
11
|
import { MaybePromise } from "@stryke/types/base";
|
|
11
12
|
import { Format } from "@storm-software/build-tools/types";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[`name`,`api`,`enforce`,`dedupe`,`
|
|
1
|
+
const e=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`];exports.PLUGIN_NON_HOOK_FIELDS=e;
|
|
@@ -39,7 +39,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
39
39
|
* @remarks
|
|
40
40
|
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
41
41
|
*
|
|
42
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
|
|
42
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
|
|
43
43
|
*
|
|
44
44
|
* @see https://vitejs.dev/guide/api-plugin#config
|
|
45
45
|
*
|
|
@@ -215,11 +215,10 @@ interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<
|
|
|
215
215
|
* @param other - The other plugin to compare against.
|
|
216
216
|
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
217
217
|
*/
|
|
218
|
-
dedupe?: false | ((other: Plugin<
|
|
218
|
+
dedupe?: false | ((other: Plugin<any>) => boolean);
|
|
219
219
|
/**
|
|
220
220
|
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
221
221
|
*/
|
|
222
|
-
dependsOn?: PluginConfig<TContext>[];
|
|
223
222
|
/**
|
|
224
223
|
* Define environments where this plugin should be active. By default, the plugin is active in all environments.
|
|
225
224
|
*
|
|
@@ -39,7 +39,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
39
39
|
* @remarks
|
|
40
40
|
* Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
|
|
41
41
|
*
|
|
42
|
-
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
|
|
42
|
+
* @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
|
|
43
43
|
*
|
|
44
44
|
* @see https://vitejs.dev/guide/api-plugin#config
|
|
45
45
|
*
|
|
@@ -215,11 +215,10 @@ interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<
|
|
|
215
215
|
* @param other - The other plugin to compare against.
|
|
216
216
|
* @returns `true` if the two plugins are the same, `false` otherwise.
|
|
217
217
|
*/
|
|
218
|
-
dedupe?: false | ((other: Plugin<
|
|
218
|
+
dedupe?: false | ((other: Plugin<any>) => boolean);
|
|
219
219
|
/**
|
|
220
220
|
* A list of pre-requisite plugins that must be loaded before this plugin can be used.
|
|
221
221
|
*/
|
|
222
|
-
dependsOn?: PluginConfig<TContext>[];
|
|
223
222
|
/**
|
|
224
223
|
* Define environments where this plugin should be active. By default, the plugin is active in all environments.
|
|
225
224
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=[`name`,`api`,`enforce`,`dedupe`,`
|
|
1
|
+
const e=[`name`,`api`,`enforce`,`dedupe`,`applyToEnvironment`];export{e as PLUGIN_NON_HOOK_FIELDS};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-esbuild",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.111",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin to build projects using esbuild.",
|
|
6
6
|
"repository": {
|
|
@@ -152,14 +152,14 @@
|
|
|
152
152
|
"defu": "^6.1.4",
|
|
153
153
|
"esbuild": "^0.25.12",
|
|
154
154
|
"jiti": "^2.6.1",
|
|
155
|
-
"powerlines": "^0.36.
|
|
155
|
+
"powerlines": "^0.36.7",
|
|
156
156
|
"unplugin": "3.0.0-beta.3"
|
|
157
157
|
},
|
|
158
158
|
"devDependencies": {
|
|
159
|
-
"@powerlines/nx": "^0.11.
|
|
160
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
159
|
+
"@powerlines/nx": "^0.11.33",
|
|
160
|
+
"@powerlines/plugin-plugin": "^0.12.54",
|
|
161
161
|
"@types/node": "^24.10.4"
|
|
162
162
|
},
|
|
163
163
|
"publishConfig": { "access": "public" },
|
|
164
|
-
"gitHead": "
|
|
164
|
+
"gitHead": "abbf694ae460ab6f58ae645a000cabf4a4fdac80"
|
|
165
165
|
}
|