@powerlines/plugin-tsup 0.12.55 → 0.12.57

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.
Files changed (59) hide show
  1. package/README.md +10 -10
  2. package/dist/helpers/index.cjs +1 -1
  3. package/dist/helpers/index.d.cts +4 -22
  4. package/dist/helpers/index.d.mts +4 -0
  5. package/dist/helpers/index.mjs +1 -0
  6. package/dist/helpers/unplugin.cjs +1 -7
  7. package/dist/helpers/unplugin.d.cts +3 -25
  8. package/dist/helpers/unplugin.d.mts +3 -0
  9. package/dist/helpers/unplugin.mjs +1 -0
  10. package/dist/helpers-CRPRhztf.mjs +1 -0
  11. package/dist/index-9iG2qHLe.d.mts +1 -0
  12. package/dist/index-D4ELpJXS.d.cts +1 -0
  13. package/dist/index-D6CnpA_r.d.cts +1 -0
  14. package/dist/index-DL0uimUT.d.mts +1 -0
  15. package/dist/index.cjs +1 -7
  16. package/dist/index.d.cts +9 -25
  17. package/dist/index.d.cts.map +1 -0
  18. package/dist/index.d.mts +14 -0
  19. package/dist/index.d.mts.map +1 -0
  20. package/dist/index.mjs +2 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/plugin-BjiGfRHE.mjs +1 -0
  23. package/dist/plugin-CD-0vofp.d.mts +1656 -0
  24. package/dist/plugin-CD-0vofp.d.mts.map +1 -0
  25. package/dist/plugin-TcZ_5Q61.d.cts +1655 -0
  26. package/dist/plugin-TcZ_5Q61.d.cts.map +1 -0
  27. package/dist/plugin-pBKbb5K9.cjs +0 -0
  28. package/dist/types/index.cjs +1 -1
  29. package/dist/types/index.d.cts +3 -20
  30. package/dist/types/index.d.mts +3 -0
  31. package/dist/types/index.mjs +1 -0
  32. package/dist/types/plugin.cjs +1 -1
  33. package/dist/types/plugin.d.cts +2 -20
  34. package/dist/types/plugin.d.mts +2 -0
  35. package/dist/types/plugin.mjs +1 -0
  36. package/dist/types-n6NgD0QK.mjs +1 -0
  37. package/dist/types-o3zWarRp.cjs +0 -0
  38. package/dist/unplugin-BCi_pCcu.mjs +7 -0
  39. package/dist/unplugin-BCi_pCcu.mjs.map +1 -0
  40. package/dist/unplugin-Bv3_8au7.d.mts +8 -0
  41. package/dist/unplugin-Bv3_8au7.d.mts.map +1 -0
  42. package/dist/unplugin-CB8KRCAV.d.cts +8 -0
  43. package/dist/unplugin-CB8KRCAV.d.cts.map +1 -0
  44. package/dist/unplugin-DboWsLXq.cjs +44 -0
  45. package/package.json +50 -32
  46. package/dist/chunk-FBBMZ4NC.cjs +0 -7
  47. package/dist/chunk-UCUR73HG.js +0 -7
  48. package/dist/helpers/index.d.ts +0 -22
  49. package/dist/helpers/index.js +0 -1
  50. package/dist/helpers/unplugin.d.ts +0 -25
  51. package/dist/helpers/unplugin.js +0 -7
  52. package/dist/index-iiumtuiw.d.cts +0 -1496
  53. package/dist/index-iiumtuiw.d.ts +0 -1496
  54. package/dist/index.d.ts +0 -30
  55. package/dist/index.js +0 -7
  56. package/dist/types/index.d.ts +0 -20
  57. package/dist/types/index.js +0 -1
  58. package/dist/types/plugin.d.ts +0 -20
  59. /package/dist/{types/plugin.js → helpers-LF26RHol.cjs} +0 -0
package/README.md CHANGED
@@ -43,15 +43,15 @@ This package is part of the ⚡<b>Powerlines</b> monorepo. Powerlines packages i
43
43
 
44
44
  <!-- END header -->
45
45
 
46
- # Powerlines - Plugin Plugin
46
+ # Powerlines - Tsup Plugin
47
47
 
48
- A package containing a Powerlines plugin to assist in developing other Powerlines plugins.
48
+ A package containing a Powerlines plugin to assist in running Tsup builds on Powerlines projects.
49
49
 
50
50
  <!-- START doctoc -->
51
51
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
52
52
  ## Table of Contents
53
53
 
54
- - [Powerlines - Plugin Plugin](#powerlines---plugin-plugin)
54
+ - [Powerlines - Tsup Plugin](#powerlines---tsup-plugin)
55
55
  - [Table of Contents](#table-of-contents)
56
56
  - [Installing](#installing)
57
57
  - [Reduced Package Size](#reduced-package-size)
@@ -74,14 +74,14 @@ A package containing a Powerlines plugin to assist in developing other Powerline
74
74
  Using [pnpm](http://pnpm.io):
75
75
 
76
76
  ```bash
77
- pnpm add @powerlines/plugin-plugin
77
+ pnpm add @powerlines/plugin-tsup
78
78
  ```
79
79
 
80
80
  <details>
81
81
  <summary>Using npm</summary>
82
82
 
83
83
  ```bash
84
- npm install @powerlines/plugin-plugin
84
+ npm install @powerlines/plugin-tsup
85
85
  ```
86
86
 
87
87
  </details>
@@ -90,14 +90,14 @@ npm install @powerlines/plugin-plugin
90
90
  <summary>Using yarn</summary>
91
91
 
92
92
  ```bash
93
- yarn add @powerlines/plugin-plugin
93
+ yarn add @powerlines/plugin-tsup
94
94
  ```
95
95
 
96
96
  </details>
97
97
 
98
98
  ## Reduced Package Size
99
99
 
100
- This project uses [tsup](https://tsup.egoist.dev/) to package the source code
100
+ This project uses [tsup](https://github.com/rolldown/tsup) to package the source code
101
101
  due to its ability to remove unused code and ship smaller javascript files
102
102
  thanks to code splitting. This helps to greatly reduce the size of the package
103
103
  and to make it easier to use in other projects.
@@ -109,16 +109,16 @@ commands are available to assist in development.
109
109
 
110
110
  ### Building
111
111
 
112
- Run `nx build plugin-plugin` to build the library.
112
+ Run `nx build plugin-tsup` to build the library.
113
113
 
114
114
  ### Running unit tests
115
115
 
116
- Run `nx test plugin-plugin` to execute the unit tests via
116
+ Run `nx test plugin-tsup` to execute the unit tests via
117
117
  [Jest](https://jestjs.io).
118
118
 
119
119
  ### Linting
120
120
 
121
- Run `nx lint plugin-plugin` to run
121
+ Run `nx lint plugin-tsup` to run
122
122
  [ESLint](https://eslint.org/) on the package.
123
123
 
124
124
  <!-- START footer -->
@@ -1 +1 @@
1
- 'use strict';var unplugin=require('./unplugin');Object.keys(unplugin).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return unplugin[k]}})});
1
+ const e=require(`../unplugin-DboWsLXq.cjs`);require(`../helpers-LF26RHol.cjs`),exports.createTsupPlugin=e.t;
@@ -1,22 +1,4 @@
1
- export { createTsupPlugin } from './unplugin.cjs';
2
- import 'esbuild';
3
- import '../index-iiumtuiw.cjs';
4
- import '@storm-software/tsup/types';
5
- import '@storm-software/build-tools/types';
6
- import '@storm-software/config-tools/types';
7
- import '@storm-software/config/types';
8
- import '@stryke/types/base';
9
- import '@stryke/types/configuration';
10
- import '@stryke/types/file';
11
- import 'vite';
12
- import '@stryke/env/get-env-paths';
13
- import '@stryke/types/package-json';
14
- import 'jiti';
15
- import 'magic-string';
16
- import 'semver';
17
- import 'ts-morph';
18
- import 'unplugin';
19
- import '@stryke/fs/resolve';
20
- import '@stryke/types/tsconfig';
21
- import 'typescript';
22
- import '@stryke/types/array';
1
+ import "../plugin-TcZ_5Q61.cjs";
2
+ import { t as createTsupPlugin } from "../unplugin-CB8KRCAV.cjs";
3
+ import "../index-D6CnpA_r.cjs";
4
+ export { createTsupPlugin };
@@ -0,0 +1,4 @@
1
+ import "../plugin-CD-0vofp.mjs";
2
+ import { t as createTsupPlugin } from "../unplugin-Bv3_8au7.mjs";
3
+ import "../index-DL0uimUT.mjs";
4
+ export { createTsupPlugin };
@@ -0,0 +1 @@
1
+ import{t as e}from"../unplugin-BCi_pCcu.mjs";import"../helpers-CRPRhztf.mjs";export{e as createTsupPlugin};
@@ -1,7 +1 @@
1
- 'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),unplugin$1=require('powerlines/lib/unplugin'),unplugin=require('unplugin');/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- function m(e){return unplugin.createEsbuildPlugin(unplugin$1.createUnplugin(e,{skipResolve:true}))({})}chunkFBBMZ4NC_cjs.a(m,"createTsupPlugin");exports.createTsupPlugin=m;
1
+ const e=require(`../unplugin-DboWsLXq.cjs`);exports.createTsupPlugin=e.t;
@@ -1,25 +1,3 @@
1
- import * as esbuild from 'esbuild';
2
- import { T as TsupPluginContext } from '../index-iiumtuiw.cjs';
3
- import '@storm-software/tsup/types';
4
- import '@storm-software/build-tools/types';
5
- import '@storm-software/config-tools/types';
6
- import '@storm-software/config/types';
7
- import '@stryke/types/base';
8
- import '@stryke/types/configuration';
9
- import '@stryke/types/file';
10
- import 'vite';
11
- import '@stryke/env/get-env-paths';
12
- import '@stryke/types/package-json';
13
- import 'jiti';
14
- import 'magic-string';
15
- import 'semver';
16
- import 'ts-morph';
17
- import 'unplugin';
18
- import '@stryke/fs/resolve';
19
- import '@stryke/types/tsconfig';
20
- import 'typescript';
21
- import '@stryke/types/array';
22
-
23
- declare function createTsupPlugin(context: TsupPluginContext): esbuild.Plugin;
24
-
25
- export { createTsupPlugin };
1
+ import "../plugin-TcZ_5Q61.cjs";
2
+ import { t as createTsupPlugin } from "../unplugin-CB8KRCAV.cjs";
3
+ export { createTsupPlugin };
@@ -0,0 +1,3 @@
1
+ import "../plugin-CD-0vofp.mjs";
2
+ import { t as createTsupPlugin } from "../unplugin-Bv3_8au7.mjs";
3
+ export { createTsupPlugin };
@@ -0,0 +1 @@
1
+ import{t as e}from"../unplugin-BCi_pCcu.mjs";export{e as createTsupPlugin};
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.cjs CHANGED
@@ -1,7 +1 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),types$1=require('@storm-software/config-tools/types'),tsup=require('@storm-software/tsup'),append=require('@stryke/path/append'),a=require('defu'),tsup$1=require('powerlines/lib/build/tsup'),unplugin=require('./helpers/unplugin'),helpers=require('./helpers'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);/*****************************************
2
- *
3
- * ⚡ Built by Storm Software
4
- *
5
- *****************************************/
6
-
7
- const c=chunkFBBMZ4NC_cjs.a((r={})=>({name:"tsup",config(){return this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:["cjs","esm"]},build:{...r,variant:"tsup"}}},async build(){return tsup.build(await tsup.resolveOptions(a__default.default({config:false,entry:Object.fromEntries(Object.entries(tsup$1.resolveTsupEntry(this,this.entry)).map(([i,t])=>[i,append.appendPath(t,this.config.projectRoot)])),esbuildOptions:chunkFBBMZ4NC_cjs.a((i,t)=>{this.config.build.variant==="tsup"&&this.config.build.esbuildOptions&&this.config.build.esbuildOptions?.(i,t),i.alias={...this.builtins.reduce((s,e)=>{const n=this.fs.ids[e];return n&&(s[e]=n),s},{}),...i.alias};},"esbuildOptions"),silent:false,verbose:true},tsup$1.extractTsupConfig(this),{esbuildPlugins:[unplugin.createTsupPlugin(this)]})))}}),"plugin");var A=c;exports.default=A;exports.plugin=c;Object.keys(helpers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return helpers[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
1
+ Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./unplugin-DboWsLXq.cjs`);require(`./helpers-LF26RHol.cjs`),require(`./plugin-pBKbb5K9.cjs`),require(`./types-o3zWarRp.cjs`);let t=require(`@storm-software/config-tools/types`),n=require(`@storm-software/tsup`),r=require(`@stryke/path/append`),i=require(`defu`);i=e.i(i);let a=require(`@storm-software/tsup/constants`),o=require(`@stryke/helpers/omit`),s=require(`@stryke/path/join-paths`),c=require(`@stryke/path/replace`);require(`@stryke/string-format/camel-case`);let l=require(`@stryke/type-checks/is-string`);function u(t,n=[]){return n.reduce((n,r)=>((0,l.isString)(r)?n[(0,c.replaceExtension)((0,c.replacePath)(r,t.config.sourceRoot||t.config.projectRoot))]=(0,c.replacePath)(r,t.config.sourceRoot||t.config.projectRoot):n[r.output||e.r(t,r.input||r)]=e.n(t,r.input||r),n),{})}const d={...a.DEFAULT_BUILD_OPTIONS,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 f(e,t){return u(e,t)}function p(e){return(0,i.default)({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`?(0,o.omit)(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}},d)}const m=(a={})=>({name:`tsup`,config(){return this.log(t.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:[`cjs`,`esm`]},build:{...a,variant:`tsup`}}},async build(){return(0,n.build)(await(0,n.resolveOptions)((0,i.default)({config:!1,entry:Object.fromEntries(Object.entries(f(this,this.entry)).map(([e,t])=>[e,(0,r.appendPath)(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},p(this),{esbuildPlugins:[e.t(this)]})))}});var h=m;exports.createTsupPlugin=e.t,exports.default=h,exports.plugin=m;
package/dist/index.d.cts CHANGED
@@ -1,30 +1,14 @@
1
- import { T as TsupPluginContext, a as TsupPluginOptions, P as Plugin } from './index-iiumtuiw.cjs';
2
- export { c as TsupPluginResolvedConfig, b as TsupPluginUserConfig, f as __ΩTsupPluginContext, _ as __ΩTsupPluginOptions, e as __ΩTsupPluginResolvedConfig, d as __ΩTsupPluginUserConfig } from './index-iiumtuiw.cjs';
3
- export { createTsupPlugin } from './helpers/unplugin.cjs';
4
- import '@storm-software/tsup/types';
5
- import '@storm-software/build-tools/types';
6
- import '@storm-software/config-tools/types';
7
- import '@storm-software/config/types';
8
- import '@stryke/types/base';
9
- import '@stryke/types/configuration';
10
- import '@stryke/types/file';
11
- import 'vite';
12
- import '@stryke/env/get-env-paths';
13
- import '@stryke/types/package-json';
14
- import 'jiti';
15
- import 'magic-string';
16
- import 'semver';
17
- import 'ts-morph';
18
- import 'unplugin';
19
- import '@stryke/fs/resolve';
20
- import '@stryke/types/tsconfig';
21
- import 'typescript';
22
- import '@stryke/types/array';
23
- import 'esbuild';
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-TcZ_5Q61.cjs";
2
+ import { t as createTsupPlugin } from "./unplugin-CB8KRCAV.cjs";
3
+ import "./index-D6CnpA_r.cjs";
4
+ import "./index-D4ELpJXS.cjs";
5
+
6
+ //#region src/index.d.ts
24
7
 
25
8
  /**
26
9
  * A Powerlines plugin to use Tsup to build the project.
27
10
  */
28
11
  declare const plugin: <TContext extends TsupPluginContext = TsupPluginContext>(options?: TsupPluginOptions) => Plugin<TContext>;
29
-
30
- export { TsupPluginContext, TsupPluginOptions, plugin as default, plugin };
12
+ //#endregion
13
+ export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
14
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,14 @@
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-CD-0vofp.mjs";
2
+ import { t as createTsupPlugin } from "./unplugin-Bv3_8au7.mjs";
3
+ import "./index-DL0uimUT.mjs";
4
+ import "./index-9iG2qHLe.mjs";
5
+
6
+ //#region src/index.d.ts
7
+
8
+ /**
9
+ * A Powerlines plugin to use Tsup to build the project.
10
+ */
11
+ declare const plugin: <TContext extends TsupPluginContext = TsupPluginContext>(options?: TsupPluginOptions) => Plugin<TContext>;
12
+ //#endregion
13
+ export { TsupPluginContext, TsupPluginOptions, TsupPluginResolvedConfig, TsupPluginUserConfig, __ΩTsupPluginContext, __ΩTsupPluginOptions, __ΩTsupPluginResolvedConfig, __ΩTsupPluginUserConfig, createTsupPlugin, plugin as default, plugin };
14
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
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"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{n as e,r as t,t as n}from"./unplugin-BCi_pCcu.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
@@ -0,0 +1 @@
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\n },\n extractTsupConfig(this),\n {\n esbuildPlugins: [createTsupPlugin(this)]\n }\n )\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"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"}
@@ -0,0 +1 @@
1
+ export{};