@powerlines/plugin-tsup 0.12.59 → 0.12.61

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/README.md CHANGED
@@ -252,7 +252,11 @@ specification. Contributions of any kind welcome!
252
252
  <br />
253
253
 
254
254
  <div align="center">
255
- <img src="https://public.storm-cdn.com/brand-banner.png" width="100%" alt="Storm Software" />
255
+ <picture>
256
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp">
257
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light-optimized.webp">
258
+ <img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark-optimized.webp" width="100%" alt="Storm Software" />
259
+ </picture>
256
260
  </div>
257
261
  <br />
258
262
 
@@ -1,4 +1,4 @@
1
- import "../plugin-CQKl_2Hs.mjs";
2
- import { t as createTsupPlugin } from "../unplugin-DqiZyeWy.mjs";
1
+ import "../plugin-CuD02liY.mjs";
2
+ import { t as createTsupPlugin } from "../unplugin-5RBFFBgw.mjs";
3
3
  import "../index-DL0uimUT.mjs";
4
4
  export { createTsupPlugin };
@@ -1,3 +1,3 @@
1
- import "../plugin-CQKl_2Hs.mjs";
2
- import { t as createTsupPlugin } from "../unplugin-DqiZyeWy.mjs";
1
+ import "../plugin-CuD02liY.mjs";
2
+ import { t as createTsupPlugin } from "../unplugin-5RBFFBgw.mjs";
3
3
  export { createTsupPlugin };
package/dist/index.d.cts CHANGED
@@ -10,5 +10,4 @@ import "./index-D4ELpJXS.cjs";
10
10
  */
11
11
  declare const plugin: <TContext extends TsupPluginContext = TsupPluginContext>(options?: TsupPluginOptions) => Plugin<TContext>;
12
12
  //#endregion
13
- export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
14
- //# sourceMappingURL=index.d.cts.map
13
+ export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, l as Plugin, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "./plugin-CQKl_2Hs.mjs";
2
- import { t as createTsupPlugin } from "./unplugin-DqiZyeWy.mjs";
1
+ import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, l as Plugin, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "./plugin-CuD02liY.mjs";
2
+ import { t as createTsupPlugin } from "./unplugin-5RBFFBgw.mjs";
3
3
  import "./index-DL0uimUT.mjs";
4
4
  import "./index-9iG2qHLe.mjs";
5
5
 
@@ -10,5 +10,4 @@ import "./index-9iG2qHLe.mjs";
10
10
  */
11
11
  declare const plugin: <TContext extends TsupPluginContext = TsupPluginContext>(options?: TsupPluginOptions) => Plugin<TContext>;
12
12
  //#endregion
13
- export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
14
- //# sourceMappingURL=index.d.mts.map
13
+ export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import{n as e,r as t,t as n}from"./unplugin-Dujx3xzl.mjs";import"./helpers-CRPRhztf.mjs";import"./plugin-BjiGfRHE.mjs";import"./types-n6NgD0QK.mjs";import{LogLevelLabel as r}from"@storm-software/config-tools/types";import{build as i,resolveOptions as a}from"@storm-software/tsup";import{appendPath as o}from"@stryke/path/append";import s from"defu";import{DEFAULT_BUILD_OPTIONS as c}from"@storm-software/tsup/constants";import{omit as l}from"@stryke/helpers/omit";import{joinPaths as u}from"@stryke/path/join-paths";import{replaceExtension as d,replacePath as f}from"@stryke/path/replace";import"@stryke/string-format/camel-case";import{isString as p}from"@stryke/type-checks/is-string";function m(n,r=[]){return r.reduce((r,i)=>(p(i)?r[d(f(i,n.config.sourceRoot||n.config.projectRoot))]=f(i,n.config.sourceRoot||n.config.projectRoot):r[i.output||t(n,i.input||i)]=e(n,i.input||i),r),{})}const h={...c,platform:`neutral`,target:`esnext`,config:!1,minify:!0,sourcemap:!1,cjsInterop:!0,bundle:!0,dts:!0,shims:!0,silent:!0,treeshake:!0,keepNames:!0,splitting:!0,banner:{}};function g(e,t){return m(e,t)}function _(e){return s({esbuildOptions:(t,n)=>{e.config.build.variant===`tsup`&&(e.config.build.esbuildOptions?e.config.build.esbuildOptions?.(t,n):e.config.build.override.esbuildOptions&&e.config.build.override.esbuildOptions?.(t,n)),t.alias={...e.builtins.reduce((t,n)=>{let r=e.fs.ids[n];return r&&(t[n]=r),t},{}),...t.alias}},noExternal:e.builtins},e.config.build.variant===`tsup`?e.config.build.override:{},e.config.build.variant===`tsup`?l(e.config.build,[`override`,`variant`]):{},{name:e.config.name,assets:e.config.output.assets,resolveExtensions:e.config.build.extensions,outputPath:e.config.output.buildPath,projectRoot:e.config.projectRoot,tsconfig:e.tsconfig.tsconfigFilePath,dts:{compilerOptions:e.tsconfig.tsconfigJson.compilerOptions},format:e.config.output.format,mode:e.config.mode,treeshake:e.config.build.variant===`tsup`?e.config.build?.treeshake:e.config.build.variant===`tsup`?e.config.build?.treeShaking:void 0,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`,silent:e.config.logLevel===null||e.config.mode===`production`,verbose:e.config.logLevel===null||e.config.logLevel===`trace`||e.config.mode===`development`,workspaceConfig:{workspaceRoot:e.workspaceConfig.workspaceRoot}},h)}const v=(e={})=>({name:`tsup`,config(){return this.log(r.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:[`cjs`,`esm`]},build:{...e,variant:`tsup`}}},async build(){return i(await a(s({config:!1,entry:Object.fromEntries(Object.entries(g(this,this.entry)).map(([e,t])=>[e,o(t,this.config.projectRoot)])),esbuildOptions:(e,t)=>{this.config.build.variant===`tsup`&&this.config.build.esbuildOptions&&this.config.build.esbuildOptions?.(e,t),e.alias={...this.builtins.reduce((e,t)=>{let n=this.fs.ids[t];return n&&(e[t]=n),e},{}),...e.alias}},silent:!1,verbose:!0},_(this),{esbuildPlugins:[n(this)]})))}});var y=v;export{n as createTsupPlugin,y as default,v as plugin};
2
- //# sourceMappingURL=index.mjs.map
1
+ import{n as e,r as t,t as n}from"./unplugin-Dujx3xzl.mjs";import"./helpers-CRPRhztf.mjs";import"./plugin-BjiGfRHE.mjs";import"./types-n6NgD0QK.mjs";import{LogLevelLabel as r}from"@storm-software/config-tools/types";import{build as i,resolveOptions as a}from"@storm-software/tsup";import{appendPath as o}from"@stryke/path/append";import s from"defu";import{DEFAULT_BUILD_OPTIONS as c}from"@storm-software/tsup/constants";import{omit as l}from"@stryke/helpers/omit";import{joinPaths as u}from"@stryke/path/join-paths";import{replaceExtension as d,replacePath as f}from"@stryke/path/replace";import"@stryke/string-format/camel-case";import{isString as p}from"@stryke/type-checks/is-string";function m(n,r=[]){return r.reduce((r,i)=>(p(i)?r[d(f(i,n.config.sourceRoot||n.config.projectRoot))]=f(i,n.config.sourceRoot||n.config.projectRoot):r[i.output||t(n,i.input||i)]=e(n,i.input||i),r),{})}const h={...c,platform:`neutral`,target:`esnext`,config:!1,minify:!0,sourcemap:!1,cjsInterop:!0,bundle:!0,dts:!0,shims:!0,silent:!0,treeshake:!0,keepNames:!0,splitting:!0,banner:{}};function g(e,t){return m(e,t)}function _(e){return s({esbuildOptions:(t,n)=>{e.config.build.variant===`tsup`&&(e.config.build.esbuildOptions?e.config.build.esbuildOptions?.(t,n):e.config.build.override.esbuildOptions&&e.config.build.override.esbuildOptions?.(t,n)),t.alias={...e.builtins.reduce((t,n)=>{let r=e.fs.ids[n];return r&&(t[n]=r),t},{}),...t.alias}},noExternal:e.builtins},e.config.build.variant===`tsup`?e.config.build.override:{},e.config.build.variant===`tsup`?l(e.config.build,[`override`,`variant`]):{},{name:e.config.name,assets:e.config.output.assets,resolveExtensions:e.config.build.extensions,outputPath:e.config.output.buildPath,projectRoot:e.config.projectRoot,tsconfig:e.tsconfig.tsconfigFilePath,dts:{compilerOptions:e.tsconfig.tsconfigJson.compilerOptions},format:e.config.output.format,mode:e.config.mode,treeshake:e.config.build.variant===`tsup`?e.config.build?.treeshake:e.config.build.variant===`tsup`?e.config.build?.treeShaking:void 0,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`,silent:e.config.logLevel===null||e.config.mode===`production`,verbose:e.config.logLevel===null||e.config.logLevel===`trace`||e.config.mode===`development`,workspaceConfig:{workspaceRoot:e.workspaceConfig.workspaceRoot}},h)}const v=(e={})=>({name:`tsup`,config(){return this.log(r.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:[`cjs`,`esm`]},build:{...e,variant:`tsup`}}},async build(){return i(await a(s({config:!1,entry:Object.fromEntries(Object.entries(g(this,this.entry)).map(([e,t])=>[e,o(t,this.config.projectRoot)])),esbuildOptions:(e,t)=>{this.config.build.variant===`tsup`&&this.config.build.esbuildOptions&&this.config.build.esbuildOptions?.(e,t),e.alias={...this.builtins.reduce((e,t)=>{let n=this.fs.ids[t];return n&&(e[t]=n),e},{}),...e.alias}},silent:!1,verbose:!0},_(this),{esbuildPlugins:[n(this)]})))}});var y=v;export{n as createTsupPlugin,y as default,v as plugin};
@@ -1653,5 +1653,4 @@ declare type __ΩTsupPluginUserConfig = any[];
1653
1653
  declare type __ΩTsupPluginResolvedConfig = any[];
1654
1654
  declare type __ΩTsupPluginContext = any[];
1655
1655
  //#endregion
1656
- export { __ΩTsupPluginContext as a, __ΩTsupPluginUserConfig as c, TsupPluginUserConfig as i, Plugin as l, TsupPluginOptions as n, __ΩTsupPluginOptions as o, TsupPluginResolvedConfig as r, __ΩTsupPluginResolvedConfig as s, TsupPluginContext as t };
1657
- //# sourceMappingURL=plugin-CuD02liY.d.mts.map
1656
+ export { __ΩTsupPluginContext as a, __ΩTsupPluginUserConfig as c, TsupPluginUserConfig as i, Plugin as l, TsupPluginOptions as n, __ΩTsupPluginOptions as o, TsupPluginResolvedConfig as r, __ΩTsupPluginResolvedConfig as s, TsupPluginContext as t };
@@ -1651,5 +1651,4 @@ declare type __ΩTsupPluginUserConfig = any[];
1651
1651
  declare type __ΩTsupPluginResolvedConfig = any[];
1652
1652
  declare type __ΩTsupPluginContext = any[];
1653
1653
  //#endregion
1654
- export { __ΩTsupPluginContext as a, __ΩTsupPluginUserConfig as c, TsupPluginUserConfig as i, Plugin as l, TsupPluginOptions as n, __ΩTsupPluginOptions as o, TsupPluginResolvedConfig as r, __ΩTsupPluginResolvedConfig as s, TsupPluginContext as t };
1655
- //# sourceMappingURL=plugin-sukB8kwz.d.cts.map
1654
+ export { __ΩTsupPluginContext as a, __ΩTsupPluginUserConfig as c, TsupPluginUserConfig as i, Plugin as l, TsupPluginOptions as n, __ΩTsupPluginOptions as o, TsupPluginResolvedConfig as r, __ΩTsupPluginResolvedConfig as s, TsupPluginContext as t };
@@ -1,3 +1,3 @@
1
- import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "../plugin-CQKl_2Hs.mjs";
1
+ import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "../plugin-CuD02liY.mjs";
2
2
  import "../index-9iG2qHLe.mjs";
3
3
  export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig };
@@ -1,2 +1,2 @@
1
- import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "../plugin-CQKl_2Hs.mjs";
1
+ import { a as __ΩTsupPluginContext, c as __ΩTsupPluginUserConfig, i as TsupPluginUserConfig, n as TsupPluginOptions, o as __ΩTsupPluginOptions, r as TsupPluginResolvedConfig, s as __ΩTsupPluginResolvedConfig, t as TsupPluginContext } from "../plugin-CuD02liY.mjs";
2
2
  export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig };
@@ -4,5 +4,4 @@ import * as esbuild0 from "esbuild";
4
4
  //#region src/helpers/unplugin.d.ts
5
5
  declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
6
6
  //#endregion
7
- export { createTsupPlugin as t };
8
- //# sourceMappingURL=unplugin-5RBFFBgw.d.mts.map
7
+ export { createTsupPlugin as t };
@@ -4,5 +4,4 @@ import * as esbuild0 from "esbuild";
4
4
  //#region src/helpers/unplugin.d.ts
5
5
  declare function createTsupPlugin(context: TsupPluginContext): esbuild0.Plugin;
6
6
  //#endregion
7
- export { createTsupPlugin as t };
8
- //# sourceMappingURL=unplugin-ApYAf1Su.d.cts.map
7
+ export { createTsupPlugin as t };
@@ -3,5 +3,4 @@ ${n.config.build.polyfill.map(e=>`import "${e}";`).join(`
3
3
  `)}
4
4
 
5
5
  export * from "${l(i)?i:i.id}";
6
- `,e.file),e.file}return i}async function a(e){let t=await n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`pre`},e);return t||(t=await n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`normal`},e),t)||(t=await n.load(e),t)?t:n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`post`},e)}async function o(e,t){let r=e;for(let e of n.$$internal.environment.selectHooks(`transform`)){let i=await e.handle.apply(Z(n,this),[X(r),t]);i&&(r=i)}return r}async function c(){return t(e.DEBUG,`Powerlines build plugin finishing...`),n.$$internal.callHook(`buildEnd`,{sequential:!0})}async function u(){return t(e.DEBUG,`Finalizing Powerlines project output...`),n.$$internal.callHook(`writeBundle`,{sequential:!0})}return{name:`powerlines`,api:n.$$internal.api,resolveId:{filter:{id:{include:[/.*/]}},handler:i},load:{filter:{id:{include:[/.*/]}},handler:a},transform:o,buildStart:r,buildEnd:c,writeBundle:u,vite:{sharedDuringBuild:!0}}}catch(n){throw t(e.FATAL,n?.message),n}}}function $(e){return f(Q(e))({})}export{I as n,L as r,$ as t};
7
- //# sourceMappingURL=unplugin-Dujx3xzl.mjs.map
6
+ `,e.file),e.file}return i}async function a(e){let t=await n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`pre`},e);return t||(t=await n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`normal`},e),t)||(t=await n.load(e),t)?t:n.$$internal.callHook(`load`,{sequential:!0,result:`first`,order:`post`},e)}async function o(e,t){let r=e;for(let e of n.$$internal.environment.selectHooks(`transform`)){let i=await e.handle.apply(Z(n,this),[X(r),t]);i&&(r=i)}return r}async function c(){return t(e.DEBUG,`Powerlines build plugin finishing...`),n.$$internal.callHook(`buildEnd`,{sequential:!0})}async function u(){return t(e.DEBUG,`Finalizing Powerlines project output...`),n.$$internal.callHook(`writeBundle`,{sequential:!0})}return{name:`powerlines`,api:n.$$internal.api,resolveId:{filter:{id:{include:[/.*/]}},handler:i},load:{filter:{id:{include:[/.*/]}},handler:a},transform:o,buildStart:r,buildEnd:c,writeBundle:u,vite:{sharedDuringBuild:!0}}}catch(n){throw t(e.FATAL,n?.message),n}}}function $(e){return f(Q(e))({})}export{I as n,L as r,$ as t};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-tsup",
3
- "version": "0.12.59",
3
+ "version": "0.12.61",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -145,18 +145,18 @@
145
145
  "files": ["dist/**/*"],
146
146
  "keywords": ["tsup", "powerlines", "storm-software", "powerlines-plugin"],
147
147
  "dependencies": {
148
- "@storm-software/tsup": "^0.2.50",
148
+ "@storm-software/tsup": "^0.2.52",
149
149
  "@stryke/path": "^0.22.0",
150
150
  "@stryke/type-checks": "^0.4.4",
151
151
  "@stryke/types": "^0.10.13",
152
152
  "defu": "^6.1.4",
153
- "powerlines": "^0.30.1"
153
+ "powerlines": "^0.30.3"
154
154
  },
155
155
  "devDependencies": {
156
- "@powerlines/nx": "^0.10.50",
157
- "@powerlines/plugin-plugin": "^0.12.2",
156
+ "@powerlines/nx": "^0.10.52",
157
+ "@powerlines/plugin-plugin": "^0.12.4",
158
158
  "@types/node": "^24.10.1"
159
159
  },
160
160
  "publishConfig": { "access": "public" },
161
- "gitHead": "499105ba7cabc6fa139bbc6829746a15c5c59357"
161
+ "gitHead": "8f31b1531e973824d7c3d58abe08c1f1f75e36e5"
162
162
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,iBAAA,GAAoB,iBAApB,CAAA,CAAA,OAAA,CAAA,EAC7B,iBAD6B,EAAA,GAErC,MAFqC,CAE9B,QAF8B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,iBAAA,GAAoB,iBAApB,CAAA,CAAA,OAAA,CAAA,EAC7B,iBAD6B,EAAA,GAErC,MAFqC,CAE9B,QAF8B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":["DEFAULT_TSUP_CONFIG: Partial<TsupBuildConfig>","defu","defu","options"],"sources":["../../powerlines/src/lib/build/esbuild.ts","../../powerlines/src/lib/build/tsup.ts","../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { omit } from \"@stryke/helpers/omit\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { BuildOptions, Format, LogLevel, Platform } from \"esbuild\";\nimport {\n ESBuildBuildConfig,\n ESBuildResolvedBuildConfig,\n TsupBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport type { ResolvedEntryTypeDefinition } from \"../../types/resolved\";\nimport { resolveEntryInputFile, resolveEntryOutput } from \"../entry\";\n\n// const resolverPlugin = (\n// context: Context,\n// options: Pick<\n// BuildResolvedConfig,\n// \"external\" | \"noExternal\" | \"skipNodeModulesBundle\"\n// > = {}\n// ): Plugin => {\n// return {\n// name: \"powerlines:resolver\",\n// setup(build) {\n// const skipNodeModulesBundle =\n// options.skipNodeModulesBundle ??\n// context.config.build.skipNodeModulesBundle;\n// const external = options.external ?? context.config.build.external ?? [];\n// const noExternal =\n// options.noExternal ?? context.config.build.noExternal ?? [];\n// const resolvePatterns = skipNodeModulesBundle\n// ? tsconfigPathsToRegExp(context.tsconfig.options.paths ?? [])\n// : [];\n\n// const handle = async (args: OnResolveArgs) => {\n// const result = await handleResolveId(\n// context,\n// {\n// id: args.path,\n// importer: args.importer,\n// options: {\n// isEntry: false\n// }\n// },\n// {\n// skipNodeModulesBundle,\n// external,\n// noExternal,\n// resolvePatterns\n// }\n// );\n// if (!result) {\n// return;\n// }\n\n// return {\n// path: result?.id,\n// external: result?.external\n// };\n// };\n\n// build.onResolve({ filter: /.*/ }, handle);\n// build.onResolve({ filter: /^storm:/ }, handle);\n// }\n// };\n// };\n\nexport const DEFAULT_ESBUILD_CONFIG: Partial<ESBuildResolvedBuildConfig> = {\n target: \"esnext\",\n platform: \"neutral\" as Platform,\n format: \"esm\" as Format,\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\" as LogLevel\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveESBuildEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): ESBuildResolvedBuildConfig[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[\n replaceExtension(\n replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n )\n )\n ] = replacePath(\n entry,\n context.config.sourceRoot || context.config.projectRoot\n );\n } else {\n ret[entry.output || resolveEntryOutput(context, entry.input || entry)] =\n resolveEntryInputFile(context, entry.input || entry);\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @returns The resolved esbuild options.\n */\nexport function extractESBuildConfig(context: Context): BuildOptions {\n const inject =\n context.config.build.override.inject ?? context.config.build.inject;\n if (inject && Object.keys(inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.builtins.reduce(\n (ret, id) => {\n if (!ret[id]) {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n }\n\n return ret;\n },\n context.config.build.alias\n ? Array.isArray(context.config.build.alias)\n ? context.config.build.alias.reduce(\n (ret, alias) => {\n if (!ret[alias.find.toString()]) {\n ret[alias.find.toString()] = alias.replacement;\n }\n\n return ret;\n },\n {} as Record<string, string>\n )\n : context.config.build.alias\n : {}\n ),\n inject:\n inject && Object.keys(inject).length > 0\n ? [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.projectRoot,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build.override, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\"\n ]) as BuildOptions)\n : {},\n context.config.build.variant === \"esbuild\"\n ? (omit(context.config.build, [\n \"alias\",\n \"inject\",\n \"external\",\n \"noExternal\",\n \"skipNodeModulesBundle\",\n \"extensions\",\n \"variant\",\n \"override\"\n ]) as BuildOptions)\n : {},\n {\n mainFields: context.config.build.mainFields,\n conditions: context.config.build.conditions,\n define: context.config.build.define,\n resolveExtensions: context.config.build.extensions,\n packages: context.config.build.skipNodeModulesBundle\n ? \"external\"\n : context.config.build.variant === \"esbuild\"\n ? (context.config.build as ESBuildBuildConfig).packages\n : undefined,\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.build.platform,\n treeShaking:\n Boolean((context.config.build as TsupBuildConfig)?.treeshake) ||\n (context.config.build as ESBuildBuildConfig)?.treeShaking,\n outdir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\"\n },\n DEFAULT_ESBUILD_CONFIG\n ) as BuildOptions;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { AssetGlob, Entry } from \"@storm-software/build-tools/types\";\nimport { DEFAULT_BUILD_OPTIONS } from \"@storm-software/tsup/constants\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport defu from \"defu\";\nimport {\n ESBuildBuildConfig,\n TsupBuildConfig,\n TsupResolvedBuildConfig\n} from \"../../types/build\";\nimport { Context } from \"../../types/context\";\nimport { ResolvedEntryTypeDefinition } from \"../../types/resolved\";\nimport { resolveESBuildEntry } from \"./esbuild\";\n\nexport const DEFAULT_TSUP_CONFIG: Partial<TsupBuildConfig> = {\n ...DEFAULT_BUILD_OPTIONS,\n platform: \"neutral\",\n target: \"esnext\",\n config: false,\n minify: true,\n sourcemap: false,\n cjsInterop: true,\n bundle: true,\n dts: true,\n shims: true,\n silent: true,\n treeshake: true,\n keepNames: true,\n splitting: true,\n banner: {}\n};\n\n/**\n * Resolves the entry options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveTsupEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[]\n): Entry {\n return resolveESBuildEntry(context, entryPoints) as Entry;\n}\n\n/**\n * Resolves the options for [tsup](https://github.com/egoist/tsup).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function extractTsupConfig(context: Context): TsupResolvedBuildConfig {\n return defu(\n {\n esbuildOptions: (options, ctx) => {\n if (context.config.build.variant === \"tsup\") {\n if (\n (\n context.config.build as Omit<\n TsupResolvedBuildConfig,\n \"projectRoot\"\n >\n ).esbuildOptions\n ) {\n (\n context.config.build as Omit<\n TsupResolvedBuildConfig,\n \"projectRoot\"\n >\n ).esbuildOptions?.(options, ctx);\n } else if (\n (context.config.build.override as TsupResolvedBuildConfig)\n .esbuildOptions\n ) {\n (\n context.config.build.override as TsupResolvedBuildConfig\n ).esbuildOptions?.(options, ctx);\n }\n }\n\n options.alias = {\n ...context.builtins.reduce(\n (ret, id) => {\n const path = context.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n noExternal: context.builtins\n },\n context.config.build.variant === \"tsup\"\n ? context.config.build.override\n : {},\n context.config.build.variant === \"tsup\"\n ? omit(context.config.build, [\"override\", \"variant\"])\n : {},\n {\n name: context.config.name,\n assets: context.config.output.assets as (string | AssetGlob)[],\n resolveExtensions: context.config.build.extensions,\n outputPath: context.config.output.buildPath,\n projectRoot: context.config.projectRoot,\n tsconfig: context.tsconfig.tsconfigFilePath,\n dts: {\n compilerOptions: context.tsconfig.tsconfigJson.compilerOptions\n },\n format: context.config.output.format,\n mode: context.config.mode,\n treeshake:\n context.config.build.variant === \"tsup\"\n ? (context.config.build as TsupBuildConfig)?.treeshake\n : context.config.build.variant === \"tsup\"\n ? (context.config.build as ESBuildBuildConfig)?.treeShaking\n : undefined,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n silent:\n context.config.logLevel === null ||\n context.config.mode === \"production\",\n verbose:\n context.config.logLevel === null ||\n context.config.logLevel === \"trace\" ||\n context.config.mode === \"development\",\n workspaceConfig: { workspaceRoot: context.workspaceConfig.workspaceRoot }\n },\n DEFAULT_TSUP_CONFIG\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { build, resolveOptions } from \"@storm-software/tsup\";\nimport { appendPath } from \"@stryke/path/append\";\nimport defu from \"defu\";\nimport { extractTsupConfig, resolveTsupEntry } from \"powerlines/lib/build/tsup\";\nimport { TsupResolvedBuildConfig } from \"powerlines/types/build\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { createTsupPlugin } from \"./helpers/unplugin\";\nimport {\n TsupPluginContext,\n TsupPluginOptions,\n TsupPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to use Tsup to build the project.\n */\nexport const plugin = <TContext extends TsupPluginContext = TsupPluginContext>(\n options: TsupPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"tsup\",\n config() {\n this.log(\n LogLevelLabel.TRACE,\n \"Providing default configuration for the Powerlines `tsup` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n build: {\n ...options,\n variant: \"tsup\"\n }\n } as Partial<TsupPluginResolvedConfig>;\n },\n async build() {\n return build(\n await resolveOptions(\n defu(\n {\n config: false,\n entry: Object.fromEntries(\n Object.entries(resolveTsupEntry(this, this.entry)).map(\n ([key, value]) => [\n key,\n appendPath(value, this.config.projectRoot)\n ]\n )\n ),\n esbuildOptions: (options, ctx) => {\n if (this.config.build.variant === \"tsup\") {\n if (\n (\n this.config.build as Omit<\n TsupResolvedBuildConfig,\n \"projectRoot\"\n >\n ).esbuildOptions\n ) {\n (\n this.config.build as Omit<\n TsupResolvedBuildConfig,\n \"projectRoot\"\n >\n ).esbuildOptions?.(options, ctx);\n }\n }\n\n options.alias = {\n ...this.builtins.reduce(\n (ret, id) => {\n const path = this.fs.ids[id];\n if (path) {\n ret[id] = path;\n }\n\n return ret;\n },\n {} as Record<string, string>\n ),\n ...options.alias\n };\n },\n silent: false,\n verbose: true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