@powerlines/plugin-esbuild 0.13.56 → 0.13.58
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 +8 -2
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.d.cts +4 -24
- package/dist/helpers/index.d.mts +4 -0
- package/dist/helpers/index.mjs +1 -0
- package/dist/helpers/unplugin.cjs +1 -7
- package/dist/helpers/unplugin.d.cts +3 -27
- package/dist/helpers/unplugin.d.mts +3 -0
- package/dist/helpers/unplugin.mjs +1 -0
- package/dist/helpers-CRPRhztf.mjs +1 -0
- package/dist/index-9iG2qHLe.d.mts +1 -0
- package/dist/index-D4ELpJXS.d.cts +1 -0
- package/dist/index-D6CnpA_r.d.cts +1 -0
- package/dist/index-DL0uimUT.d.mts +1 -0
- package/dist/index.cjs +14 -7
- package/dist/index.d.cts +9 -27
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +15 -0
- package/dist/index.mjs.map +1 -0
- package/dist/plugin-BjiGfRHE.mjs +1 -0
- package/dist/plugin-CgFOBwxh.d.cts +1653 -0
- package/dist/plugin-CgFOBwxh.d.cts.map +1 -0
- package/dist/plugin-D-5wnEv7.d.mts +1656 -0
- package/dist/plugin-D-5wnEv7.d.mts.map +1 -0
- package/dist/plugin-pBKbb5K9.cjs +0 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +3 -23
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +1 -1
- package/dist/types/plugin.d.cts +2 -23
- package/dist/types/plugin.d.mts +2 -0
- package/dist/types/plugin.mjs +1 -0
- package/dist/types-n6NgD0QK.mjs +1 -0
- package/dist/types-o3zWarRp.cjs +0 -0
- package/dist/unplugin-3lhr_MA6.mjs +7 -0
- package/dist/unplugin-3lhr_MA6.mjs.map +1 -0
- package/dist/unplugin-BFoBFgpW.d.cts +8 -0
- package/dist/unplugin-BFoBFgpW.d.cts.map +1 -0
- package/dist/unplugin-BU4hcV_s.cjs +44 -0
- package/dist/unplugin-CCMrEgTM.d.mts +8 -0
- package/dist/unplugin-CCMrEgTM.d.mts.map +1 -0
- package/package.json +51 -33
- package/dist/chunk-FBBMZ4NC.cjs +0 -7
- package/dist/chunk-UCUR73HG.js +0 -7
- package/dist/helpers/index.d.ts +0 -24
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/unplugin.d.ts +0 -27
- package/dist/helpers/unplugin.js +0 -7
- package/dist/index-DjkWYPhS.d.cts +0 -1564
- package/dist/index-DjkWYPhS.d.ts +0 -1564
- package/dist/index.d.ts +0 -32
- package/dist/index.js +0 -7
- package/dist/types/index.d.ts +0 -23
- package/dist/types/index.js +0 -1
- package/dist/types/plugin.d.ts +0 -23
- /package/dist/{types/plugin.js → helpers-LF26RHol.cjs} +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
<!-- markdownlint-disable -->
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
<div align="center"
|
|
6
|
+
<div align="center">
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-dark-optimized.gif">
|
|
9
|
+
<source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-light-optimized.gif">
|
|
10
|
+
<img src="https://public.storm-cdn.com/powerlines/banner-1280x640-dark-optimized.gif" width="100%" alt="Powerlines" />
|
|
11
|
+
</picture>
|
|
12
|
+
</div>
|
|
7
13
|
<br />
|
|
8
14
|
|
|
9
15
|
<div align="center">
|
|
@@ -16,7 +22,7 @@
|
|
|
16
22
|
</div>
|
|
17
23
|
|
|
18
24
|
<br />
|
|
19
|
-
This package is part of the
|
|
25
|
+
This package is part of the 🔌 <b>Powerlines</b> monorepo. Powerlines packages include CLI utility applications, tools, and various libraries used to create modern, scalable web applications.
|
|
20
26
|
<br />
|
|
21
27
|
|
|
22
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=require(`../unplugin-BU4hcV_s.cjs`);require(`../helpers-LF26RHol.cjs`),exports.createESBuildPlugin=e.t;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import '@stryke/http/fetch';
|
|
6
|
-
import '@stryke/types/base';
|
|
7
|
-
import '@stryke/types/package-json';
|
|
8
|
-
import 'jiti';
|
|
9
|
-
import 'magic-string';
|
|
10
|
-
import 'oxc-parser';
|
|
11
|
-
import 'semver';
|
|
12
|
-
import 'ts-morph';
|
|
13
|
-
import 'undici';
|
|
14
|
-
import 'unplugin';
|
|
15
|
-
import '@storm-software/build-tools/types';
|
|
16
|
-
import '@storm-software/config-tools/types';
|
|
17
|
-
import '@storm-software/config/types';
|
|
18
|
-
import '@stryke/types/configuration';
|
|
19
|
-
import '@stryke/types/file';
|
|
20
|
-
import 'vite';
|
|
21
|
-
import '@stryke/fs/resolve';
|
|
22
|
-
import '@stryke/types/array';
|
|
23
|
-
import '@stryke/types/tsconfig';
|
|
24
|
-
import 'typescript';
|
|
1
|
+
import "../plugin-CgFOBwxh.cjs";
|
|
2
|
+
import { t as createESBuildPlugin } from "../unplugin-BFoBFgpW.cjs";
|
|
3
|
+
import "../index-D6CnpA_r.cjs";
|
|
4
|
+
export { createESBuildPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../unplugin-3lhr_MA6.mjs";import"../helpers-CRPRhztf.mjs";export{e as createESBuildPlugin};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
* ⚡ Built by Storm Software
|
|
4
|
-
*
|
|
5
|
-
*****************************************/
|
|
6
|
-
|
|
7
|
-
function g(t){return unplugin.createEsbuildPlugin(unplugin$1.createUnplugin(t))({})}chunkFBBMZ4NC_cjs.a(g,"createESBuildPlugin");exports.createESBuildPlugin=g;
|
|
1
|
+
const e=require(`../unplugin-BU4hcV_s.cjs`);exports.createESBuildPlugin=e.t;
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import '@stryke/http/fetch';
|
|
5
|
-
import '@stryke/types/base';
|
|
6
|
-
import '@stryke/types/package-json';
|
|
7
|
-
import 'jiti';
|
|
8
|
-
import 'magic-string';
|
|
9
|
-
import 'oxc-parser';
|
|
10
|
-
import 'semver';
|
|
11
|
-
import 'ts-morph';
|
|
12
|
-
import 'undici';
|
|
13
|
-
import 'unplugin';
|
|
14
|
-
import '@storm-software/build-tools/types';
|
|
15
|
-
import '@storm-software/config-tools/types';
|
|
16
|
-
import '@storm-software/config/types';
|
|
17
|
-
import '@stryke/types/configuration';
|
|
18
|
-
import '@stryke/types/file';
|
|
19
|
-
import 'vite';
|
|
20
|
-
import '@stryke/fs/resolve';
|
|
21
|
-
import '@stryke/types/array';
|
|
22
|
-
import '@stryke/types/tsconfig';
|
|
23
|
-
import 'typescript';
|
|
24
|
-
|
|
25
|
-
declare function createESBuildPlugin(context: ESBuildPluginContext): esbuild.Plugin;
|
|
26
|
-
|
|
27
|
-
export { createESBuildPlugin };
|
|
1
|
+
import "../plugin-CgFOBwxh.cjs";
|
|
2
|
+
import { t as createESBuildPlugin } from "../unplugin-BFoBFgpW.cjs";
|
|
3
|
+
export { createESBuildPlugin };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"../unplugin-3lhr_MA6.mjs";export{e as createESBuildPlugin};
|
|
@@ -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,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./unplugin-BU4hcV_s.cjs`);require(`./helpers-LF26RHol.cjs`),require(`./plugin-pBKbb5K9.cjs`),require(`./types-o3zWarRp.cjs`);let t=require(`defu`);t=e.i(t);let n=require(`esbuild`),r=require(`@stryke/helpers/omit`),i=require(`@stryke/path/join-paths`),a=require(`@stryke/path/replace`),o=require(`@stryke/string-format/camel-case`),s=require(`@stryke/type-checks/is-string`);const c={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function l(t,n=[]){return n.reduce((n,r)=>((0,s.isString)(r)?n[(0,a.replaceExtension)((0,a.replacePath)(r,t.config.sourceRoot||t.config.projectRoot))]=(0,a.replacePath)(r,t.config.sourceRoot||t.config.projectRoot):n[r.output||e.r(t,r.input||r)]=e.n(t,r.input||r),n),{})}function u(e){let n=e.config.build.override.inject??e.config.build.inject;return n&&Object.keys(n).length>0&&e.fs.writeSync((0,i.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(n).map(([e,t])=>{if(t)if(Array.isArray(t)){if((0,o.camelCase)(e)!==e){if(t.length===1)return`
|
|
2
|
+
import ${(0,o.camelCase)(e)} from "${t[0]}";
|
|
3
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`;if(t.length>1)return`
|
|
4
|
+
import ${t[1]===`*`?`* as ${(0,o.camelCase)(e)}`:`{ ${t[1]} as ${(0,o.camelCase)(e)} }`} from "${t[0]}";
|
|
5
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`}else if(t.length===1)return`
|
|
6
|
+
import ${e} from "${t[0]}";
|
|
7
|
+
export { ${e} };`;else if(t.length>1)return`
|
|
8
|
+
import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
|
|
9
|
+
export { ${e} };`}else if((0,o.camelCase)(e)!==e)return`
|
|
10
|
+
import ${(0,o.camelCase)(e)} from "${t[0]}";
|
|
11
|
+
export { ${(0,o.camelCase)(e)} as "${e}" }`;else return`
|
|
12
|
+
import ${e} from "${t}";
|
|
13
|
+
export { ${e} };`;return``}).join(`
|
|
14
|
+
`)),(0,t.default)({alias:e.builtins.reduce((t,n)=>{if(!t[n]){let r=e.fs.ids[n];r&&(t[n]=r)}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):e.config.build.alias:{}),inject:n&&Object.keys(n).length>0?[(0,i.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?(0,r.omit)(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?(0,r.omit)(e.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:e.config.build.mainFields,conditions:e.config.build.conditions,define:e.config.build.define,resolveExtensions:e.config.build.extensions,packages:e.config.build.skipNodeModulesBundle?`external`:e.config.build.variant===`esbuild`?e.config.build.packages:void 0,format:Array.isArray(e.config.output.format)?e.config.output.format[0]:e.config.output.format,platform:e.config.build.platform,treeShaking:!!e.config.build?.treeshake||e.config.build?.treeShaking,outdir:e.config.output.buildPath,tsconfig:e.tsconfig.tsconfigFilePath,tsconfigRaw:e.tsconfig.tsconfigJson,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`},c)}const d=(r={})=>({name:`esbuild`,config(){return{output:{format:[`esm`]},build:{...c,...r,variant:`esbuild`}}},async build(){await(0,n.build)((0,t.default)({entryPoints:l(this,this.entry),plugins:[e.t(this)]},u(this)))}});var f=d;exports.createESBuildPlugin=e.t,exports.default=f,exports.plugin=d;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import '@stryke/types/base';
|
|
8
|
-
import '@stryke/types/package-json';
|
|
9
|
-
import 'jiti';
|
|
10
|
-
import 'magic-string';
|
|
11
|
-
import 'oxc-parser';
|
|
12
|
-
import 'semver';
|
|
13
|
-
import 'ts-morph';
|
|
14
|
-
import 'undici';
|
|
15
|
-
import 'unplugin';
|
|
16
|
-
import '@storm-software/build-tools/types';
|
|
17
|
-
import '@storm-software/config-tools/types';
|
|
18
|
-
import '@storm-software/config/types';
|
|
19
|
-
import '@stryke/types/configuration';
|
|
20
|
-
import '@stryke/types/file';
|
|
21
|
-
import 'vite';
|
|
22
|
-
import '@stryke/fs/resolve';
|
|
23
|
-
import '@stryke/types/array';
|
|
24
|
-
import '@stryke/types/tsconfig';
|
|
25
|
-
import 'typescript';
|
|
1
|
+
import { a as __ΩESBuildPluginOptions, i as __ΩESBuildPluginContext, n as ESBuildPluginOptions, o as __ΩESBuildPluginResolvedConfig, r as ESBuildPluginResolvedConfig, s as Plugin, t as ESBuildPluginContext } from "./plugin-CgFOBwxh.cjs";
|
|
2
|
+
import { t as createESBuildPlugin } from "./unplugin-BFoBFgpW.cjs";
|
|
3
|
+
import "./index-D6CnpA_r.cjs";
|
|
4
|
+
import "./index-D4ELpJXS.cjs";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
26
7
|
|
|
27
8
|
/**
|
|
28
9
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
29
10
|
*/
|
|
30
11
|
declare const plugin: <TContext extends ESBuildPluginContext = ESBuildPluginContext>(options?: ESBuildPluginOptions) => Plugin<TContext>;
|
|
31
|
-
|
|
32
|
-
export { ESBuildPluginContext, ESBuildPluginOptions, plugin as default, plugin };
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ESBuildPluginContext, ESBuildPluginOptions, ESBuildPluginResolvedConfig, __ΩESBuildPluginContext, __ΩESBuildPluginOptions, __ΩESBuildPluginResolvedConfig, createESBuildPlugin, 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":";;;;;;;;;AAoCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,oBAAA,GAAuB,oBAAvB,CAAA,CAAA,OAAA,CAAA,EAER,oBAFQ,EAAA,GAGhB,MAHgB,CAGT,QAHS,CAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { a as __ΩESBuildPluginOptions, i as __ΩESBuildPluginContext, n as ESBuildPluginOptions, o as __ΩESBuildPluginResolvedConfig, r as ESBuildPluginResolvedConfig, s as Plugin, t as ESBuildPluginContext } from "./plugin-D-5wnEv7.mjs";
|
|
2
|
+
import { t as createESBuildPlugin } from "./unplugin-CCMrEgTM.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 assist in developing other Powerlines plugins.
|
|
10
|
+
*/
|
|
11
|
+
declare const plugin: <TContext extends ESBuildPluginContext = ESBuildPluginContext>(options?: ESBuildPluginOptions) => Plugin<TContext>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ESBuildPluginContext, ESBuildPluginOptions, ESBuildPluginResolvedConfig, __ΩESBuildPluginContext, __ΩESBuildPluginOptions, __ΩESBuildPluginResolvedConfig, createESBuildPlugin, 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":";;;;;;;;;AAoCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,oBAAA,GAAuB,oBAAvB,CAAA,CAAA,OAAA,CAAA,EAER,oBAFQ,EAAA,GAGhB,MAHgB,CAGT,QAHS,CAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./unplugin-3lhr_MA6.mjs";import"./helpers-CRPRhztf.mjs";import"./plugin-BjiGfRHE.mjs";import"./types-n6NgD0QK.mjs";import r from"defu";import{build as i}from"esbuild";import{omit as a}from"@stryke/helpers/omit";import{joinPaths as o}from"@stryke/path/join-paths";import{replaceExtension as s,replacePath as c}from"@stryke/path/replace";import{camelCase as l}from"@stryke/string-format/camel-case";import{isString as u}from"@stryke/type-checks/is-string";const d={target:`esnext`,platform:`neutral`,format:`esm`,write:!0,minify:!0,sourcemap:!1,bundle:!0,treeShaking:!0,keepNames:!0,splitting:!0,logLevel:`silent`};function f(n,r=[]){return r.reduce((r,i)=>(u(i)?r[s(c(i,n.config.sourceRoot||n.config.projectRoot))]=c(i,n.config.sourceRoot||n.config.projectRoot):r[i.output||t(n,i.input||i)]=e(n,i.input||i),r),{})}function p(e){let t=e.config.build.override.inject??e.config.build.inject;return t&&Object.keys(t).length>0&&e.fs.writeSync(o(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`),Object.entries(t).map(([e,t])=>{if(t)if(Array.isArray(t)){if(l(e)!==e){if(t.length===1)return`
|
|
2
|
+
import ${l(e)} from "${t[0]}";
|
|
3
|
+
export { ${l(e)} as "${e}" }`;if(t.length>1)return`
|
|
4
|
+
import ${t[1]===`*`?`* as ${l(e)}`:`{ ${t[1]} as ${l(e)} }`} from "${t[0]}";
|
|
5
|
+
export { ${l(e)} as "${e}" }`}else if(t.length===1)return`
|
|
6
|
+
import ${e} from "${t[0]}";
|
|
7
|
+
export { ${e} };`;else if(t.length>1)return`
|
|
8
|
+
import ${t[1]===`*`?`* as ${e}`:`{ ${t[1]} as ${e} }`} from "${t[0]}";
|
|
9
|
+
export { ${e} };`}else if(l(e)!==e)return`
|
|
10
|
+
import ${l(e)} from "${t[0]}";
|
|
11
|
+
export { ${l(e)} as "${e}" }`;else return`
|
|
12
|
+
import ${e} from "${t}";
|
|
13
|
+
export { ${e} };`;return``}).join(`
|
|
14
|
+
`)),r({alias:e.builtins.reduce((t,n)=>{if(!t[n]){let r=e.fs.ids[n];r&&(t[n]=r)}return t},e.config.build.alias?Array.isArray(e.config.build.alias)?e.config.build.alias.reduce((e,t)=>(e[t.find.toString()]||(e[t.find.toString()]=t.replacement),e),{}):e.config.build.alias:{}),inject:t&&Object.keys(t).length>0?[o(e.workspaceConfig.workspaceRoot,e.config.projectRoot,e.artifactsPath,`inject-shim.js`)]:void 0},e.config.build.variant===`esbuild`?a(e.config.build.override,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`]):{},e.config.build.variant===`esbuild`?a(e.config.build,[`alias`,`inject`,`external`,`noExternal`,`skipNodeModulesBundle`,`extensions`,`variant`,`override`]):{},{mainFields:e.config.build.mainFields,conditions:e.config.build.conditions,define:e.config.build.define,resolveExtensions:e.config.build.extensions,packages:e.config.build.skipNodeModulesBundle?`external`:e.config.build.variant===`esbuild`?e.config.build.packages:void 0,format:Array.isArray(e.config.output.format)?e.config.output.format[0]:e.config.output.format,platform:e.config.build.platform,treeShaking:!!e.config.build?.treeshake||e.config.build?.treeShaking,outdir:e.config.output.buildPath,tsconfig:e.tsconfig.tsconfigFilePath,tsconfigRaw:e.tsconfig.tsconfigJson,minify:e.config.mode!==`development`,metafile:e.config.mode===`development`,sourcemap:e.config.mode===`development`},d)}const m=(e={})=>({name:`esbuild`,config(){return{output:{format:[`esm`]},build:{...d,...e,variant:`esbuild`}}},async build(){await i(r({entryPoints:f(this,this.entry),plugins:[n(this)]},p(this)))}});var h=m;export{n as createESBuildPlugin,h as default,m as plugin};
|
|
15
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["DEFAULT_ESBUILD_CONFIG: Partial<ESBuildResolvedBuildConfig>","defu","defu"],"sources":["../../powerlines/src/lib/build/esbuild.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 defu from \"defu\";\nimport { build } from \"esbuild\";\nimport {\n DEFAULT_ESBUILD_CONFIG,\n extractESBuildConfig,\n resolveESBuildEntry\n} from \"powerlines/lib/build/esbuild\";\nimport { ESBuildUserConfig } from \"powerlines/types/config\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { createESBuildPlugin } from \"./helpers/unplugin\";\nimport { ESBuildPluginContext, ESBuildPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends ESBuildPluginContext = ESBuildPluginContext\n>(\n options: ESBuildPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"esbuild\",\n config() {\n return {\n output: {\n format: [\"esm\"]\n },\n build: {\n ...DEFAULT_ESBUILD_CONFIG,\n ...options,\n variant: \"esbuild\"\n }\n } as Partial<ESBuildUserConfig>;\n },\n async build() {\n await build(\n defu(\n {\n entryPoints: resolveESBuildEntry(this, this.entry),\n plugins: [createESBuildPlugin(this)]\n },\n extractESBuildConfig(this)\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":"ueAuFA,MAAaA,EAA8D,CACzE,OAAQ,SACR,SAAU,UACV,OAAQ,MACR,MAAO,GACP,OAAQ,GACR,UAAW,GACX,OAAQ,GACR,YAAa,GACb,UAAW,GACX,UAAW,GACX,SAAU,SACX,CASD,SAAgB,EACd,EACA,EAAwD,EAAE,CACf,CAC3C,OAAO,EAAY,QAChB,EAAK,KACA,EAAS,EAAM,CACjB,EACE,EACE,EACE,EACA,EAAQ,OAAO,YAAc,EAAQ,OAAO,YAC7C,CACF,EACC,EACF,EACA,EAAQ,OAAO,YAAc,EAAQ,OAAO,YAC7C,CAED,EAAI,EAAM,QAAU,EAAmB,EAAS,EAAM,OAAS,EAAM,EACnE,EAAsB,EAAS,EAAM,OAAS,EAAM,CAGjD,GAET,EAAE,CACH,CASH,S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