@powerlines/plugin-esbuild 0.13.111 โ 0.13.112
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 +6 -4
- package/dist/powerlines/src/api.mjs +1 -1
- package/dist/powerlines/src/lib/contexts/api-context.cjs +1 -1
- package/dist/powerlines/src/lib/contexts/api-context.mjs +1 -1
- package/dist/powerlines/src/lib/contexts/environment-context.cjs +1 -1
- package/dist/powerlines/src/lib/contexts/environment-context.mjs +1 -1
- package/dist/powerlines/src/lib/logger.cjs +1 -1
- package/dist/powerlines/src/lib/logger.mjs +1 -1
- package/dist/powerlines/src/lib/utilities/meta.cjs +1 -1
- package/dist/powerlines/src/lib/utilities/meta.mjs +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/build.cjs +1 -0
- package/dist/powerlines/src/types/build.mjs +1 -0
- package/dist/powerlines/src/types/config.d.cts +1 -1
- package/dist/powerlines/src/types/config.d.mts +1 -1
- package/dist/powerlines/src/types/plugin.cjs +1 -1
- package/dist/powerlines/src/types/plugin.mjs +1 -1
- package/package.json +5 -5
|
@@ -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(`@stryke/path/join-paths`),f=require(`@stryke/path/replace`),p=require(`@stryke/convert/to-array`),
|
|
2
|
-
`)}`:``}.`),await o.resolveTsconfig(e),await i.installDependencies(e),await this.callHook(`configResolved`,{environment:e,order:`post`}),e.log(
|
|
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(`@stryke/path/join-paths`),f=require(`@stryke/path/replace`),p=require(`@stryke/type-checks/is-string`),m=require(`@stryke/convert/to-array`),h=require(`@stryke/fs/list-files`),g=require(`@stryke/path/append`),_=require(`@stryke/type-checks/is-set-string`),v=require(`@storm-software/config-tools/types`),y=require(`@babel/core`),b=require(`@storm-software/config-tools/logger/console`),x=require(`@stryke/fs/helpers`),S=require(`@stryke/fs/install`),C=require(`@stryke/fs/package-fns`),w=require(`@stryke/fs/resolve`),T=require(`@stryke/type-checks/is-error`),E=require(`@stryke/type-checks/is-function`),D=require(`@stryke/type-checks/is-number`),O=require(`@stryke/type-checks/is-object`),k=require(`@stryke/type-checks/is-promise`),A=require(`@stryke/type-checks/is-set`),j=require(`@stryke/type-checks/is-set-object`),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(v.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(v.LogLevelLabel.TRACE,` ๐๏ธ Preparing the Powerlines project`),this.context.log(v.LogLevelLabel.TRACE,` โ๏ธ Aggregating configuration options for the Powerlines project`),await this.context.withInlineConfig(e),await this.#r(async e=>{if(e.log(v.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(v.LogLevelLabel.DEBUG,`The configuration provided ${(0,m.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
|
+
`)}`:``}.`),await o.resolveTsconfig(e),await i.installDependencies(e),await this.callHook(`configResolved`,{environment:e,order:`post`}),e.log(v.LogLevelLabel.TRACE,`Powerlines configuration has been resolved: \n\n${(0,b.formatLogMessage)(e.config)}`),e.fs.existsSync(e.cachePath)||await(0,x.createDirectory)(e.cachePath),e.fs.existsSync(e.dataPath)||await(0,x.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(v.LogLevelLabel.TRACE,`Preparing the TypeScript definitions for the Powerlines project.`),e.fs.existsSync(e.dtsPath)&&await e.fs.remove(e.dtsPath),e.log(v.LogLevelLabel.TRACE,`Transforming built-ins runtime modules files.`);let r=await Promise.all((await e.getBuiltins()).map(async n=>{let r=await(0,y.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(v.LogLevelLabel.TRACE,`Writing transformed built-in runtime file ${n.id}.`),await e.emitBuiltin(r.code,n.id,n.path),n.path}));if(!await(0,w.resolvePackage)(`typescript`))throw Error(`Could not resolve TypeScript package location. Please ensure TypeScript is installed.`);let i=r.reduce((t,n)=>{let r=(0,f.replacePath)(n,e.workspaceConfig.workspaceRoot);return t.includes(r)||t.push(r),t},[]);e.log(v.LogLevelLabel.TRACE,`Parsing TypeScript configuration for the Powerlines project.`);let s=await n.emitTypes(e,i);e.log(v.LogLevelLabel.TRACE,`Generating TypeScript declaration file ${e.dtsPath}.`);let c=[],l=e=>(0,O.isObject)(e)?e.code:e,d=await this.callHook(`types`,{environment:e,sequential:!0,order:`pre`,result:`merge`,asNextParam:l},s);if(d&&((0,j.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,_.isSetString)(d)&&(s=d)),d=await this.callHook(`types`,{environment:e,sequential:!0,order:`normal`,result:`merge`,asNextParam:l},s),d&&((0,j.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,_.isSetString)(d)&&(s=d)),d=await this.callHook(`types`,{environment:e,sequential:!0,order:`post`,result:`merge`,asNextParam:l},s),d&&((0,j.isSetObject)(d)?(s=d.code,Array.isArray(d.directives)&&d.directives.length>0&&c.push(...d.directives)):(0,_.isSetString)(d)&&(s=d)),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(
|
|
9
|
-
|
|
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(v.LogLevelLabel.INFO,`Powerlines API has been prepared successfully`)}async new(e){this.context.log(v.LogLevelLabel.INFO,`๐ Creating a new Powerlines project`),await this.prepare(e),await this.#r(async e=>{e.log(v.LogLevelLabel.TRACE,`Initializing the processing options for the Powerlines project.`),await this.callHook(`new`,{environment:e,order:`pre`});let t=await(0,h.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/common/**/*.hbs`));for(let n of t){e.log(v.LogLevelLabel.TRACE,`Adding template file: ${n}`);let t=N.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,h.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/application/**/*.hbs`));for(let n of t){e.log(v.LogLevelLabel.TRACE,`Adding application template file: ${n}`);let t=N.default.compile(n);await e.fs.write((0,d.joinPaths)(e.config.projectRoot,n.replace(`.hbs`,``)),t(e))}}else{let t=await(0,h.listFiles)((0,d.joinPaths)(e.powerlinesPath,`files/library/**/*.hbs`));for(let n of t){e.log(v.LogLevelLabel.TRACE,`Adding library template file: ${n}`);let t=N.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(v.LogLevelLabel.TRACE,`Powerlines - New command completed`)}async clean(e={command:`clean`}){this.context.log(v.LogLevelLabel.INFO,`๐งน Cleaning the previous Powerlines artifacts`),await this.prepare(e),await this.#r(async e=>{this.context.log(v.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(v.LogLevelLabel.TRACE,`Powerlines - Clean command completed`)}async lint(e={command:`lint`}){this.context.log(v.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(v.LogLevelLabel.TRACE,`Powerlines linting completed`)}async build(e={command:`build`}){this.context.log(v.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(v.LogLevelLabel.TRACE,`Powerlines build completed`)}async docs(e={command:`docs`}){this.context.log(v.LogLevelLabel.INFO,`๐ Generating documentation for the Powerlines project`),await this.prepare(e),await this.#r(async t=>{t.log(v.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(v.LogLevelLabel.TRACE,`Powerlines documentation generation completed`)}async deploy(e={command:`deploy`}){this.context.log(v.LogLevelLabel.INFO,`๐ฆ Deploying the Powerlines project`),await this.prepare(e),await this.#r(async e=>{await this.callHook(`deploy`,{environment:e})}),this.context.log(v.LogLevelLabel.TRACE,`Powerlines deploy completed`)}async finalize(){this.context.log(v.LogLevelLabel.TRACE,`Powerlines finalize execution started`),await this.#r(async e=>{await this.callHook(`finalize`,{environment:e}),await e.fs.dispose()}),this.context.log(v.LogLevelLabel.TRACE,`Powerlines finalize execution completed`)}async callHook(e,t,...n){return r.callHook((0,j.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,g.appendPath)(e.config.output.buildPath,e.workspaceConfig.workspaceRoot),n=(0,d.joinPaths)((0,g.appendPath)(e.config.output.outputPath,e.workspaceConfig.workspaceRoot),`dist`);e.fs.existsSync(t)&&t!==n&&(e.log(v.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(v.LogLevelLabel.DEBUG,`Copying asset(s): ${M.default.redBright(e.workspaceConfig.workspaceRoot===t.input?t.glob:(0,d.joinPaths)((0,f.replacePath)(t.input,e.workspaceConfig.workspaceRoot),t.glob))} -> ${M.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=>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(v.LogLevelLabel.DEBUG,`No environments are configured for this Powerlines project. Using the default environment.`),[await this.context.getEnvironment()]):(this.context.log(v.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,A.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(v.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,k.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,E.isFunction)(t))n=(0,m.toArray)(await Promise.resolve(t()));else if((0,p.isString)(t)){let e=await this.#o(t);n=(0,E.isFunction)(e)?(0,m.toArray)(await Promise.resolve(e())):(0,m.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,_.isSetString)(e)){let t=await this.#o(e);n=(0,E.isFunction)(t)?(0,m.toArray)(await Promise.resolve(r?t(r):t())):(0,m.toArray)(t)}else (0,E.isFunction)(e)?n=(0,m.toArray)(await Promise.resolve(e(r))):Array.isArray(e)&&e.every(s.isPlugin)?n=e:s.isPlugin(e)&&(n=(0,m.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(v.LogLevelLabel.TRACE,`Duplicate ${M.default.bold.cyanBright(e.name)} plugin dependency detected - Skipping initialization.`):(r.push(e),this.context.log(v.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,C.isPackageExists)(e,{paths:[this.context.workspaceConfig.workspaceRoot,this.context.config.projectRoot]});if(!t&&this.context.config.skipInstalls!==!0){this.#e.log(v.LogLevelLabel.WARN,`The plugin package "${e}" is not installed. It will be installed automatically.`);let t=await(0,S.install)(e,{cwd:this.context.config.projectRoot});if((0,D.isNumber)(t.exitCode)&&t.exitCode>0)throw this.#e.log(v.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}":
|
|
11
|
+
${(0,T.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,
|
|
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{joinPaths as y}from"@stryke/path/join-paths";import{replacePath as b}from"@stryke/path/replace";import{isString as x}from"@stryke/type-checks/is-string";import{toArray as S}from"@stryke/convert/to-array";import{listFiles as C}from"@stryke/fs/list-files";import{appendPath as w}from"@stryke/path/append";import{isSetString as T}from"@stryke/type-checks/is-set-string";import{LogLevelLabel as E}from"@storm-software/config-tools/types";import{transformAsync as D}from"@babel/core";import{formatLogMessage as O}from"@storm-software/config-tools/logger/console";import{createDirectory as k}from"@stryke/fs/helpers";import{install as A}from"@stryke/fs/install";import{isPackageExists as j}from"@stryke/fs/package-fns";import{resolvePackage as M}from"@stryke/fs/resolve";import{isError as N}from"@stryke/type-checks/is-error";import{isFunction as P}from"@stryke/type-checks/is-function";import{isNumber as F}from"@stryke/type-checks/is-number";import{isObject as I}from"@stryke/type-checks/is-object";import{isPromiseLike as L}from"@stryke/type-checks/is-promise";import{isSet as R}from"@stryke/type-checks/is-set";import{isSetObject as z}from"@stryke/type-checks/is-set-object";import B from"chalk";import V from"handlebars";Symbol.asyncDispose;export{};
|
|
@@ -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(`@stryke/convert/to-array`),o=require(`@storm-software/config-tools/types`),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(
|
|
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(`@stryke/convert/to-array`),o=require(`@storm-software/config-tools/types`),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,a.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(o.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(o.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(o.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{toArray as o}from"@stryke/convert/to-array";import{LogLevelLabel as s}from"@storm-software/config-tools/types";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(
|
|
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{toArray as o}from"@stryke/convert/to-array";import{LogLevelLabel as s}from"@storm-software/config-tools/types";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(o(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(s.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(s.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(s.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
|
|
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
|
|
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
|
|
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
|
|
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(`@stryke/path/join-paths`),n=require(`@stryke/fs/list-files`),r=require(`@stryke/helpers/get-unique`),i=require(`@storm-software/config-tools/types`),a=require(`@stryke/fs/json`),o=require(`@stryke/path/file-path-fns`),s=require(`@stryke/fs/exists`)
|
|
1
|
+
const e=require(`../../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join-paths`),n=require(`@stryke/fs/list-files`),r=require(`@stryke/helpers/get-unique`),i=require(`@storm-software/config-tools/types`),a=require(`@stryke/fs/json`),o=require(`@stryke/path/file-path-fns`),s=require(`@stryke/fs/exists`),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 n=(0,t.joinPaths)(e.dataPath,`meta.json`);e.log(i.LogLevelLabel.DEBUG,`Writing runtime metadata to ${n}`),await e.fs.write(n,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{joinPaths as e}from"@stryke/path/join-paths";import{listFiles as t}from"@stryke/fs/list-files";import{getUnique as n}from"@stryke/helpers/get-unique";import{LogLevelLabel as r}from"@storm-software/config-tools/types";import{readJsonFile as i}from"@stryke/fs/json";import{hasFileExtension as a}from"@stryke/path/file-path-fns";import{existsSync as o}from"@stryke/fs/exists";import
|
|
1
|
+
import{joinPaths as e}from"@stryke/path/join-paths";import{listFiles as t}from"@stryke/fs/list-files";import{getUnique as n}from"@stryke/helpers/get-unique";import{LogLevelLabel as r}from"@storm-software/config-tools/types";import{readJsonFile as i}from"@stryke/fs/json";import{hasFileExtension as a}from"@stryke/path/file-path-fns";import{existsSync as o}from"@stryke/fs/exists";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(t){let n=e(t.dataPath,`meta.json`);t.log(r.DEBUG,`Writing runtime metadata to ${n}`),await t.fs.write(n,JSON.stringify(t.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/
|
|
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-set-string`),i=require(`@stryke/type-checks/is-function`),a=require(`@stryke/type-checks/is-set-object`),o=require(`@stryke/type-checks/is-undefined`);function s(e){return(0,a.isSetObject)(e)&&`name`in e&&(0,r.isSetString)(e.name)&&((0,o.isUndefined)(e.api)||`api`in e&&(0,a.isSetObject)(e.api))&&((0,o.isUndefined)(e.applyToEnvironment)||`applyToEnvironment`in e&&(0,i.isFunction)(e.applyToEnvironment))&&((0,o.isUndefined)(e.dedupe)||`dedupe`in e&&(0,i.isFunction)(e.dedupe))&&n.KNOWN_HOOKS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(f(e[t])||t===`config`&&(0,a.isSetObject)(e[t])))&&t.UNPLUGIN_BUILD_VARIANTS.every(t=>(0,o.isUndefined)(e[t])||t in e&&(0,a.isSetObject)(e[t]))}function c(e){return(0,a.isSetObject)(e)&&`plugin`in e&&(((0,r.isSetString)(e.plugin)||(0,i.isFunction)(e.plugin))&&`options`in e&&(0,a.isSetObject)(e.options)||s(e.plugin))}function l(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&(((0,r.isSetString)(e[0])||(0,i.isFunction)(e[0]))&&e.length>1&&(0,a.isSetObject)(e[1])||s(e[0]))}function u(e){return(0,r.isSetString)(e)||(0,i.isFunction)(e)||s(e)||c(e)||l(e)||Array.isArray(e)&&e.every(e=>u(e))}function d(e){return(0,a.isSetObject)(e)&&`handler`in e&&(0,i.isFunction)(e.handler)}function f(e){return(0,i.isFunction)(e)||d(e)}function p(e){return f(e)||d(e)}function m(e){return(0,i.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,i.isFunction)(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function _(e,t,n,r){g(t,r.map(e=>e.plugin))||r.push((0,i.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{
|
|
1
|
+
import{UNPLUGIN_BUILD_VARIANTS as e}from"../types/build.mjs";import{KNOWN_HOOKS as t}from"../types/plugin.mjs";import{isSetString as n}from"@stryke/type-checks/is-set-string";import{isFunction as r}from"@stryke/type-checks/is-function";import{isSetObject as i}from"@stryke/type-checks/is-set-object";import{isUndefined as a}from"@stryke/type-checks/is-undefined";function o(o){return i(o)&&`name`in o&&n(o.name)&&(a(o.api)||`api`in o&&i(o.api))&&(a(o.applyToEnvironment)||`applyToEnvironment`in o&&r(o.applyToEnvironment))&&(a(o.dedupe)||`dedupe`in o&&r(o.dedupe))&&t.every(e=>a(o[e])||e in o&&(d(o[e])||e===`config`&&i(o[e])))&&e.every(e=>a(o[e])||e in o&&i(o[e]))}function s(e){return i(e)&&`plugin`in e&&((n(e.plugin)||r(e.plugin))&&`options`in e&&i(e.options)||o(e.plugin))}function c(e){return Array.isArray(e)&&(e.length===1||e.length===2)&&((n(e[0])||r(e[0]))&&e.length>1&&i(e[1])||o(e[0]))}function l(e){return n(e)||r(e)||o(e)||s(e)||c(e)||Array.isArray(e)&&e.every(e=>l(e))}function u(e){return i(e)&&`handler`in e&&r(e.handler)}function d(e){return r(e)||u(e)}function f(e){return d(e)||u(e)}function p(e){return r(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&&(r(t.dedupe)&&t.dedupe(e)||t.name===e.name))}function g(e,t,n,i){h(t,i.map(e=>e.plugin))||i.push(r(n)?{plugin:t,handler:p(n).bind(e)}:{plugin:t,...n,handler:p(n).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> |
|
|
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> |
|
|
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=
|
|
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
|
|
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-esbuild",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.112",
|
|
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.8",
|
|
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.34",
|
|
160
|
+
"@powerlines/plugin-plugin": "^0.12.55",
|
|
161
161
|
"@types/node": "^24.10.4"
|
|
162
162
|
},
|
|
163
163
|
"publishConfig": { "access": "public" },
|
|
164
|
-
"gitHead": "
|
|
164
|
+
"gitHead": "8867c7bf5d0505b507b029ae191bfc2844478c0e"
|
|
165
165
|
}
|