@powerlines/plugin-esbuild 0.13.460 → 0.13.463

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 (70) hide show
  1. package/dist/build-B8u-bRQt.d.cts +8 -0
  2. package/dist/build-B8u-bRQt.d.cts.map +1 -0
  3. package/dist/build-VnV0tsb3.d.mts +8 -0
  4. package/dist/build-VnV0tsb3.d.mts.map +1 -0
  5. package/dist/bundle-A-22BjWv.d.mts +22 -0
  6. package/dist/bundle-A-22BjWv.d.mts.map +1 -0
  7. package/dist/bundle-B_-jRFlM.cjs +84 -0
  8. package/dist/bundle-HmHLeZt2.d.cts +22 -0
  9. package/dist/bundle-HmHLeZt2.d.cts.map +1 -0
  10. package/dist/helpers/bundle.cjs +2 -49
  11. package/dist/helpers/bundle.d.cts +2 -22
  12. package/dist/helpers/bundle.d.mts +2 -22
  13. package/dist/helpers/bundle.mjs +3 -6
  14. package/dist/helpers/bundle.mjs.map +1 -1
  15. package/dist/helpers/index.cjs +3 -9
  16. package/dist/helpers/index.d.cts +3 -5
  17. package/dist/helpers/index.d.mts +3 -5
  18. package/dist/helpers/index.mjs +1 -3
  19. package/dist/helpers/resolve.cjs +4 -5
  20. package/dist/helpers/resolve.d.cts +2 -26
  21. package/dist/helpers/resolve.d.mts +2 -26
  22. package/dist/helpers/resolve.mjs +2 -2
  23. package/dist/helpers/resolve.mjs.map +1 -1
  24. package/dist/index-BtBZHVmz.d.cts +1 -0
  25. package/dist/index-DXRuzH8z.d.mts +1 -0
  26. package/dist/index.cjs +19 -19
  27. package/dist/index.d.cts +5 -7
  28. package/dist/index.d.cts.map +1 -1
  29. package/dist/index.d.mts +5 -7
  30. package/dist/index.d.mts.map +1 -1
  31. package/dist/index.mjs +15 -10
  32. package/dist/index.mjs.map +1 -1
  33. package/dist/plugin-BuKZtP7s.d.mts +19 -0
  34. package/dist/plugin-BuKZtP7s.d.mts.map +1 -0
  35. package/dist/plugin-g0pkWAvQ.d.cts +19 -0
  36. package/dist/plugin-g0pkWAvQ.d.cts.map +1 -0
  37. package/dist/resolve-DGrNGKUw.d.mts +26 -0
  38. package/dist/resolve-DGrNGKUw.d.mts.map +1 -0
  39. package/dist/resolve-uvDtu7oi.d.cts +26 -0
  40. package/dist/resolve-uvDtu7oi.d.cts.map +1 -0
  41. package/dist/types/build.d.cts +2 -8
  42. package/dist/types/build.d.mts +2 -8
  43. package/dist/types/index.d.cts +3 -3
  44. package/dist/types/index.d.mts +3 -3
  45. package/dist/types/plugin.d.cts +2 -21
  46. package/dist/types/plugin.d.mts +2 -21
  47. package/package.json +12 -11
  48. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  49. package/dist/helpers/bundle.d.cts.map +0 -1
  50. package/dist/helpers/bundle.d.mts.map +0 -1
  51. package/dist/helpers/resolve-options.cjs +0 -91
  52. package/dist/helpers/resolve-options.d.cts +0 -23
  53. package/dist/helpers/resolve-options.d.cts.map +0 -1
  54. package/dist/helpers/resolve-options.d.mts +0 -23
  55. package/dist/helpers/resolve-options.d.mts.map +0 -1
  56. package/dist/helpers/resolve-options.mjs +0 -87
  57. package/dist/helpers/resolve-options.mjs.map +0 -1
  58. package/dist/helpers/resolve.d.cts.map +0 -1
  59. package/dist/helpers/resolve.d.mts.map +0 -1
  60. package/dist/helpers/unplugin.cjs +0 -18
  61. package/dist/helpers/unplugin.d.cts +0 -8
  62. package/dist/helpers/unplugin.d.cts.map +0 -1
  63. package/dist/helpers/unplugin.d.mts +0 -8
  64. package/dist/helpers/unplugin.d.mts.map +0 -1
  65. package/dist/helpers/unplugin.mjs +0 -17
  66. package/dist/helpers/unplugin.mjs.map +0 -1
  67. package/dist/types/build.d.cts.map +0 -1
  68. package/dist/types/build.d.mts.map +0 -1
  69. package/dist/types/plugin.d.cts.map +0 -1
  70. package/dist/types/plugin.d.mts.map +0 -1
package/dist/index.d.mts CHANGED
@@ -1,9 +1,7 @@
1
- import { EsbuildOptions, __ΩEsbuildOptions } from "./types/build.mjs";
2
- import { EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./types/plugin.mjs";
3
- import { BundleOptions, __ΩBundleOptions, bundle } from "./helpers/bundle.mjs";
4
- import { resolve, resolveModule } from "./helpers/resolve.mjs";
5
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.mjs";
6
- import { createEsbuildPlugin } from "./helpers/unplugin.mjs";
1
+ import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "./build-VnV0tsb3.mjs";
2
+ import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "./plugin-BuKZtP7s.mjs";
3
+ import { n as __ΩBundleOptions, r as bundle, t as BundleOptions } from "./bundle-A-22BjWv.mjs";
4
+ import { n as resolveModule, t as resolve } from "./resolve-DGrNGKUw.mjs";
7
5
  import { Plugin } from "@powerlines/core";
8
6
 
9
7
  //#region src/index.d.ts
@@ -17,5 +15,5 @@ declare module "@powerlines/core" {
17
15
  */
18
16
  declare const plugin: <TContext extends EsbuildPluginContext = EsbuildPluginContext>(options?: EsbuildPluginOptions) => Plugin<TContext>;
19
17
  //#endregion
20
- export { BundleOptions, DEFAULT_ESBUILD_CONFIG, EsbuildOptions, EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩBundleOptions, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
18
+ export { BundleOptions, EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩBundleOptions, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, plugin as default, plugin, resolve, resolveModule };
21
19
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;YAkCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;AAJU;cAWX,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YA8BY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;AAJU;;;AAAA,cAWX,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,11 +1,13 @@
1
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.mjs";
2
- import { createEsbuildPlugin } from "./helpers/unplugin.mjs";
3
1
  import { bundle } from "./helpers/bundle.mjs";
4
2
  import { resolve, resolveModule } from "./helpers/resolve.mjs";
5
3
  import "./helpers/index.mjs";
4
+ import "./types/index.mjs";
5
+ import { createUnplugin } from "@powerlines/core";
6
6
  import { formatConfig } from "@powerlines/core/plugin-utils";
7
+ import { resolveEntry, resolveOptions } from "@powerlines/unplugin/esbuild";
7
8
  import defu from "defu";
8
9
  import { build } from "esbuild";
10
+ import { createEsbuildPlugin } from "unplugin";
9
11
 
10
12
  //#region src/index.ts
11
13
  /**
@@ -17,18 +19,21 @@ const plugin = (options = {}) => {
17
19
  config() {
18
20
  return {
19
21
  output: { format: ["esm"] },
20
- esbuild: {
21
- ...DEFAULT_ESBUILD_CONFIG,
22
- ...options
23
- }
22
+ esbuild: { ...options }
24
23
  };
25
24
  },
26
25
  async build() {
27
26
  this.debug("Starting Esbuild build process...");
28
- const options = defu({
27
+ const resolved = resolveOptions(this);
28
+ const options = defu(this.config.esbuild, {
29
+ ...resolved,
29
30
  entryPoints: resolveEntry(this, this.entry),
30
- plugins: [createEsbuildPlugin(this)]
31
- }, resolveOptions(this));
31
+ config: false,
32
+ plugins: [createEsbuildPlugin(createUnplugin(this, {
33
+ silenceHookLogging: true,
34
+ name: "esbuild"
35
+ }))()]
36
+ });
32
37
  this.debug({
33
38
  meta: { category: "config" },
34
39
  message: `Resolved Esbuild configuration: \n${formatConfig(options)}`
@@ -39,5 +44,5 @@ const plugin = (options = {}) => {
39
44
  };
40
45
 
41
46
  //#endregion
42
- export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
47
+ export { bundle, plugin as default, plugin, resolve, resolveModule };
43
48
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../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 { Plugin } from \"@powerlines/core\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport defu from \"defu\";\nimport { build } from \"esbuild\";\nimport {\n DEFAULT_ESBUILD_CONFIG,\n resolveEntry,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport { createEsbuildPlugin } from \"./helpers/unplugin\";\nimport { EsbuildPluginContext, EsbuildPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n esbuild?: EsbuildPluginOptions;\n }\n}\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 esbuild: {\n ...DEFAULT_ESBUILD_CONFIG,\n ...options\n }\n };\n },\n async build() {\n this.debug(\"Starting Esbuild build process...\");\n\n const options = defu(\n {\n entryPoints: resolveEntry(this, this.entry),\n plugins: [createEsbuildPlugin(this)]\n },\n resolveOptions(this)\n );\n\n this.debug({\n meta: {\n category: \"config\"\n },\n message: `Resolved Esbuild configuration: \\n${formatConfig(options)}`\n });\n\n await build(options);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;AA0CA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,SAAS;KACP,GAAG;KACH,GAAG;KACJ;IACF;;EAEH,MAAM,QAAQ;AACZ,QAAK,MAAM,oCAAoC;GAE/C,MAAM,UAAU,KACd;IACE,aAAa,aAAa,MAAM,KAAK,MAAM;IAC3C,SAAS,CAAC,oBAAoB,KAAK,CAAC;IACrC,EACD,eAAe,KAAK,CACrB;AAED,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,qCAAqC,aAAa,QAAQ;IACpE,CAAC;AAEF,SAAM,MAAM,QAAQ;;EAEvB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../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 { createUnplugin, Plugin } from \"@powerlines/core\";\nimport { formatConfig } from \"@powerlines/core/plugin-utils\";\nimport { resolveEntry, resolveOptions } from \"@powerlines/unplugin/esbuild\";\nimport defu from \"defu\";\nimport { build, BuildOptions, SameShape } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { EsbuildPluginContext, EsbuildPluginOptions } from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n esbuild?: EsbuildPluginOptions;\n }\n}\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 esbuild: {\n ...options\n }\n };\n },\n async build() {\n this.debug(\"Starting Esbuild build process...\");\n\n const resolved = resolveOptions(this);\n const options = defu(this.config.esbuild, {\n ...resolved,\n entryPoints: resolveEntry(this, this.entry),\n config: false,\n plugins: [\n createEsbuildPlugin(\n createUnplugin(this, {\n silenceHookLogging: true,\n name: \"esbuild\"\n })\n )()\n ]\n }) as SameShape<BuildOptions, BuildOptions>;\n\n this.debug({\n meta: {\n category: \"config\"\n },\n message: `Resolved Esbuild configuration: \\n${formatConfig(options)}`\n });\n\n await build(options);\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;AAsCA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,SAAS,EACP,GAAG,SACJ;IACF;;EAEH,MAAM,QAAQ;AACZ,QAAK,MAAM,oCAAoC;GAE/C,MAAM,WAAW,eAAe,KAAK;GACrC,MAAM,UAAU,KAAK,KAAK,OAAO,SAAS;IACxC,GAAG;IACH,aAAa,aAAa,MAAM,KAAK,MAAM;IAC3C,QAAQ;IACR,SAAS,CACP,oBACE,eAAe,MAAM;KACnB,oBAAoB;KACpB,MAAM;KACP,CAAC,CACH,EAAE,CACJ;IACF,CAAC;AAEF,QAAK,MAAM;IACT,MAAM,EACJ,UAAU,UACX;IACD,SAAS,qCAAqC,aAAa,QAAQ;IACpE,CAAC;AAEF,SAAM,MAAM,QAAQ;;EAEvB"}
@@ -0,0 +1,19 @@
1
+ import { t as EsbuildOptions } from "./build-VnV0tsb3.mjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
+
4
+ //#region src/types/plugin.d.ts
5
+ type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
+ interface EsbuildPluginUserConfig extends UserConfig {
7
+ esbuild?: EsbuildPluginOptions;
8
+ }
9
+ interface EsbuildPluginResolvedConfig extends ResolvedConfig {
10
+ esbuild: EsbuildOptions;
11
+ }
12
+ type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
+ declare type __ΩEsbuildPluginOptions = any[];
14
+ declare type __ΩEsbuildPluginUserConfig = any[];
15
+ declare type __ΩEsbuildPluginResolvedConfig = any[];
16
+ declare type __ΩEsbuildPluginContext = any[];
17
+ //#endregion
18
+ export { __ΩEsbuildPluginContext as a, __ΩEsbuildPluginUserConfig as c, EsbuildPluginUserConfig as i, EsbuildPluginOptions as n, __ΩEsbuildPluginOptions as o, EsbuildPluginResolvedConfig as r, __ΩEsbuildPluginResolvedConfig as s, EsbuildPluginContext as t };
19
+ //# sourceMappingURL=plugin-BuKZtP7s.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-BuKZtP7s.d.mts","names":[],"sources":["../src/types/plugin.ts"],"mappings":";;;;KAqBY,oBAAA,GAAuB,OAAA,CAAQ,cAAA;AAAA,UAE1B,uBAAA,SAAgC,UAAA;EAC/C,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,2BAAA,SAAoC,cAAA;EACnD,OAAA,EAAS,cAAA;AAAA;AAAA,KAGC,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
@@ -0,0 +1,19 @@
1
+ import { t as EsbuildOptions } from "./build-B8u-bRQt.cjs";
2
+ import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
+
4
+ //#region src/types/plugin.d.ts
5
+ type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
+ interface EsbuildPluginUserConfig extends UserConfig {
7
+ esbuild?: EsbuildPluginOptions;
8
+ }
9
+ interface EsbuildPluginResolvedConfig extends ResolvedConfig {
10
+ esbuild: EsbuildOptions;
11
+ }
12
+ type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
+ declare type __ΩEsbuildPluginOptions = any[];
14
+ declare type __ΩEsbuildPluginUserConfig = any[];
15
+ declare type __ΩEsbuildPluginResolvedConfig = any[];
16
+ declare type __ΩEsbuildPluginContext = any[];
17
+ //#endregion
18
+ export { __ΩEsbuildPluginContext as a, __ΩEsbuildPluginUserConfig as c, EsbuildPluginUserConfig as i, EsbuildPluginOptions as n, __ΩEsbuildPluginOptions as o, EsbuildPluginResolvedConfig as r, __ΩEsbuildPluginResolvedConfig as s, EsbuildPluginContext as t };
19
+ //# sourceMappingURL=plugin-g0pkWAvQ.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-g0pkWAvQ.d.cts","names":[],"sources":["../src/types/plugin.ts"],"mappings":";;;;KAqBY,oBAAA,GAAuB,OAAA,CAAQ,cAAA;AAAA,UAE1B,uBAAA,SAAgC,UAAA;EAC/C,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,2BAAA,SAAoC,cAAA;EACnD,OAAA,EAAS,cAAA;AAAA;AAAA,KAGC,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
@@ -0,0 +1,26 @@
1
+ import { t as BundleOptions } from "./bundle-A-22BjWv.mjs";
2
+ import { PluginContext } from "@powerlines/core";
3
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
4
+
5
+ //#region src/helpers/resolve.d.ts
6
+ /**
7
+ * Compiles a type definition to a module and returns the module.
8
+ *
9
+ * @param context - The context object containing the environment paths.
10
+ * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
+ * @param overrides - Optional overrides for the ESBuild configuration.
12
+ * @returns A promise that resolves to the compiled module.
13
+ */
14
+ declare function resolveModule<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
15
+ /**
16
+ * Compiles a type definition to a module and returns the specified export from the module.
17
+ *
18
+ * @param context - The context object containing the environment paths.
19
+ * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
20
+ * @param overrides - Optional overrides for the ESBuild configuration.
21
+ * @returns A promise that resolves to the compiled module.
22
+ */
23
+ declare function resolve<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
24
+ //#endregion
25
+ export { resolveModule as n, resolve as t };
26
+ //# sourceMappingURL=resolve-DGrNGKUw.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-DGrNGKUw.d.mts","names":[],"sources":["../src/helpers/resolve.ts"],"mappings":";;;;;;;AAoCA;;;;;;iBAAsB,aAAA,2BAEH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAyEW,OAAA,2BAEH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA"}
@@ -0,0 +1,26 @@
1
+ import { t as BundleOptions } from "./bundle-HmHLeZt2.cjs";
2
+ import { PluginContext } from "@powerlines/core";
3
+ import { TypeDefinitionParameter } from "@stryke/types/configuration";
4
+
5
+ //#region src/helpers/resolve.d.ts
6
+ /**
7
+ * Compiles a type definition to a module and returns the module.
8
+ *
9
+ * @param context - The context object containing the environment paths.
10
+ * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
+ * @param overrides - Optional overrides for the ESBuild configuration.
12
+ * @returns A promise that resolves to the compiled module.
13
+ */
14
+ declare function resolveModule<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
15
+ /**
16
+ * Compiles a type definition to a module and returns the specified export from the module.
17
+ *
18
+ * @param context - The context object containing the environment paths.
19
+ * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
20
+ * @param overrides - Optional overrides for the ESBuild configuration.
21
+ * @returns A promise that resolves to the compiled module.
22
+ */
23
+ declare function resolve<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
24
+ //#endregion
25
+ export { resolveModule as n, resolve as t };
26
+ //# sourceMappingURL=resolve-uvDtu7oi.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-uvDtu7oi.d.cts","names":[],"sources":["../src/helpers/resolve.ts"],"mappings":";;;;;;;AAoCA;;;;;;iBAAsB,aAAA,2BAEH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA;;;;;;;;;iBAyEW,OAAA,2BAEH,aAAA,GAAgB,aAAA,CAAA,CAEjC,OAAA,EAAS,QAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAY,aAAA,GACX,OAAA,CAAQ,OAAA"}
@@ -1,8 +1,2 @@
1
- import { BuildOptions } from "esbuild";
2
-
3
- //#region src/types/build.d.ts
4
- type EsbuildOptions = Omit<BuildOptions, "entryPoints" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel">;
5
- declare type __ΩEsbuildOptions = any[];
6
- //#endregion
7
- export { EsbuildOptions, __ΩEsbuildOptions };
8
- //# sourceMappingURL=build.d.cts.map
1
+ import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "../build-B8u-bRQt.cjs";
2
+ export { EsbuildOptions, __ΩEsbuildOptions };
@@ -1,8 +1,2 @@
1
- import { BuildOptions } from "esbuild";
2
-
3
- //#region src/types/build.d.ts
4
- type EsbuildOptions = Omit<BuildOptions, "entryPoints" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel">;
5
- declare type __ΩEsbuildOptions = any[];
6
- //#endregion
7
- export { EsbuildOptions, __ΩEsbuildOptions };
8
- //# sourceMappingURL=build.d.mts.map
1
+ import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "../build-VnV0tsb3.mjs";
2
+ export { EsbuildOptions, __ΩEsbuildOptions };
@@ -1,3 +1,3 @@
1
- import { EsbuildOptions, __ΩEsbuildOptions } from "./build.cjs";
2
- import { EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./plugin.cjs";
3
- export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
1
+ import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "../build-B8u-bRQt.cjs";
2
+ import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "../plugin-g0pkWAvQ.cjs";
3
+ export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
@@ -1,3 +1,3 @@
1
- import { EsbuildOptions, __ΩEsbuildOptions } from "./build.mjs";
2
- import { EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./plugin.mjs";
3
- export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
1
+ import { n as __ΩEsbuildOptions, t as EsbuildOptions } from "../build-VnV0tsb3.mjs";
2
+ import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "../plugin-BuKZtP7s.mjs";
3
+ export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
@@ -1,21 +1,2 @@
1
- import { EsbuildOptions } from "./build.cjs";
2
- import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
-
4
- //#region src/types/plugin.d.ts
5
- type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
- interface EsbuildPluginUserConfig extends UserConfig {
7
- esbuild?: EsbuildPluginOptions;
8
- }
9
- type EsbuildPluginInitialConfig = InitialPluginConfig<EsbuildPluginUserConfig>;
10
- interface EsbuildPluginResolvedConfig extends ResolvedConfig {
11
- esbuild: EsbuildOptions;
12
- }
13
- type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- declare type __ΩEsbuildPluginOptions = any[];
15
- declare type __ΩEsbuildPluginUserConfig = any[];
16
- declare type __ΩEsbuildPluginInitialConfig = any[];
17
- declare type __ΩEsbuildPluginResolvedConfig = any[];
18
- declare type __ΩEsbuildPluginContext = any[];
19
- //#endregion
20
- export { EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
21
- //# sourceMappingURL=plugin.d.cts.map
1
+ import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "../plugin-g0pkWAvQ.cjs";
2
+ export { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
@@ -1,21 +1,2 @@
1
- import { EsbuildOptions } from "./build.mjs";
2
- import { InitialPluginConfig, PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
-
4
- //#region src/types/plugin.d.ts
5
- type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
- interface EsbuildPluginUserConfig extends UserConfig {
7
- esbuild?: EsbuildPluginOptions;
8
- }
9
- type EsbuildPluginInitialConfig = InitialPluginConfig<EsbuildPluginUserConfig>;
10
- interface EsbuildPluginResolvedConfig extends ResolvedConfig {
11
- esbuild: EsbuildOptions;
12
- }
13
- type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
14
- declare type __ΩEsbuildPluginOptions = any[];
15
- declare type __ΩEsbuildPluginUserConfig = any[];
16
- declare type __ΩEsbuildPluginInitialConfig = any[];
17
- declare type __ΩEsbuildPluginResolvedConfig = any[];
18
- declare type __ΩEsbuildPluginContext = any[];
19
- //#endregion
20
- export { EsbuildPluginContext, EsbuildPluginInitialConfig, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginInitialConfig, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
21
- //# sourceMappingURL=plugin.d.mts.map
1
+ import { a as __ΩEsbuildPluginContext, c as __ΩEsbuildPluginUserConfig, i as EsbuildPluginUserConfig, n as EsbuildPluginOptions, o as __ΩEsbuildPluginOptions, r as EsbuildPluginResolvedConfig, s as __ΩEsbuildPluginResolvedConfig, t as EsbuildPluginContext } from "../plugin-BuKZtP7s.mjs";
2
+ export { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-esbuild",
3
- "version": "0.13.460",
3
+ "version": "0.13.463",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin to build projects using esbuild.",
6
6
  "keywords": ["esbuild", "powerlines", "storm-software", "powerlines-plugin"],
@@ -12,7 +12,7 @@
12
12
  "repository": {
13
13
  "type": "github",
14
14
  "url": "https://github.com/storm-software/powerlines.git",
15
- "directory": "packages/plugin-esbuild"
15
+ "directory": "packages/plugins/plugin-esbuild"
16
16
  },
17
17
  "funding": {
18
18
  "type": "github",
@@ -83,17 +83,18 @@
83
83
  "peerDependencies": { "esbuild": ">=0.27.3" },
84
84
  "peerDependenciesMeta": { "esbuild": { "optional": false } },
85
85
  "dependencies": {
86
- "@powerlines/core": "^0.47.2",
87
- "@stryke/fs": "^0.33.70",
88
- "@stryke/helpers": "^0.10.12",
89
- "@stryke/path": "^0.28.2",
90
- "@stryke/type-checks": "^0.6.5",
91
- "@stryke/types": "^0.12.0",
86
+ "@powerlines/core": "^0.9.2",
87
+ "@powerlines/unplugin": "^0.0.4",
88
+ "@stryke/fs": "^0.33.75",
89
+ "@stryke/helpers": "^0.10.15",
90
+ "@stryke/path": "^0.29.2",
91
+ "@stryke/type-checks": "^0.6.8",
92
+ "@stryke/types": "^0.12.3",
92
93
  "defu": "^6.1.7",
93
- "jiti": "^2.6.1",
94
+ "jiti": "^2.7.0",
94
95
  "unplugin": "^3.0.0"
95
96
  },
96
- "devDependencies": { "@types/node": "^25.6.0", "esbuild": "^0.27.7" },
97
+ "devDependencies": { "@types/node": "^25.7.0", "esbuild": "^0.27.7" },
97
98
  "publishConfig": { "access": "public" },
98
- "gitHead": "76fde74fd0b494596135ace273dd0d0072b7b8be"
99
+ "gitHead": "3c5c701e16af74006dd70b965009d41eb22ace2a"
99
100
  }
@@ -1,29 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KAiCY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,IAAA;EACA,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;iBAWE,MAAA,kBAAwB,aAAA,GAAgB,aAAA,CAAA,CAC5D,OAAA,EAAS,QAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KAiCY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,IAAA;EACA,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA;;;;;;;;;iBAWE,MAAA,kBAAwB,aAAA,GAAgB,aAAA,CAAA,CAC5D,OAAA,EAAS,QAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
@@ -1,91 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let defu = require("defu");
4
- defu = require_runtime.__toESM(defu, 1);
5
- let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
6
- let _stryke_path_join_paths = require("@stryke/path/join-paths");
7
- let _stryke_path_replace = require("@stryke/path/replace");
8
- let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
- let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
-
11
- //#region src/helpers/resolve-options.ts
12
- const DEFAULT_ESBUILD_CONFIG = {
13
- target: "esnext",
14
- platform: "neutral",
15
- format: "esm",
16
- write: true,
17
- minify: true,
18
- sourcemap: false,
19
- bundle: true,
20
- treeShaking: true,
21
- keepNames: true,
22
- splitting: true,
23
- logLevel: "silent"
24
- };
25
- /**
26
- * Resolves the entry options for esbuild.
27
- *
28
- * @param context - The build context.
29
- * @param entryPoints - The entry points to resolve.
30
- * @returns The resolved entry options.
31
- */
32
- function resolveEntry(context, entryPoints = []) {
33
- return entryPoints.reduce((ret, entry) => {
34
- if ((0, _stryke_type_checks_is_string.isString)(entry)) ret[(0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)(entry, context.config.root))] = (0, _stryke_path_replace.replacePath)(entry, context.config.root);
35
- else ret[entry.output || (0, _powerlines_core_lib_entry.resolveEntryOutput)(context, entry)] = entry.file;
36
- return ret;
37
- }, {});
38
- }
39
- /**
40
- * Resolves the esbuild options.
41
- *
42
- * @param context - The build context.
43
- * @returns The resolved esbuild options.
44
- */
45
- function resolveOptions(context) {
46
- if (context.config.inject && Object.keys(context.config.inject).length > 0) context.fs.writeSync((0, _stryke_path_join_paths.joinPaths)(context.config.cwd, context.config.root, context.artifactsPath, "inject-shim.js"), Object.entries(context.config.inject).map(([key, value]) => {
47
- if (value) if (Array.isArray(value)) {
48
- if ((0, _stryke_string_format_camel_case.camelCase)(key) !== key) {
49
- if (value.length === 1) return `
50
- import ${(0, _stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
51
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
52
- else if (value.length > 1) return `
53
- import ${value[1] === "*" ? `* as ${(0, _stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, _stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
54
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
55
- } else if (value.length === 1) return `
56
- import ${key} from "${value[0]}";
57
- export { ${key} };`;
58
- else if (value.length > 1) return `
59
- import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
60
- export { ${key} };`;
61
- } else if ((0, _stryke_string_format_camel_case.camelCase)(key) !== key) return `
62
- import ${(0, _stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
63
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
64
- else return `
65
- import ${key} from "${value}";
66
- export { ${key} };`;
67
- return "";
68
- }).join("\n"));
69
- return (0, defu.default)({
70
- alias: context.alias,
71
- inject: context.config.inject && Object.keys(context.config.inject).length > 0 ? [(0, _stryke_path_join_paths.joinPaths)(context.config.cwd, context.config.root, context.artifactsPath, "inject-shim.js")] : void 0
72
- }, context.config?.esbuild ? context.config.esbuild : {}, {
73
- mainFields: context.config.resolve.mainFields,
74
- conditions: context.config.resolve.conditions,
75
- define: context.config.define,
76
- resolveExtensions: context.config.resolve.extensions,
77
- packages: context.config.resolve.skipNodeModulesBundle ? "external" : context.config?.esbuild ? (context.config?.esbuild).packages : "bundle",
78
- format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
79
- platform: context.config.platform,
80
- outdir: context.config.output.path,
81
- tsconfig: context.tsconfig.tsconfigFilePath,
82
- minify: context.config.output.minify,
83
- metafile: context.config.mode === "development",
84
- sourcemap: context.config.output.sourceMap
85
- }, DEFAULT_ESBUILD_CONFIG);
86
- }
87
-
88
- //#endregion
89
- exports.DEFAULT_ESBUILD_CONFIG = DEFAULT_ESBUILD_CONFIG;
90
- exports.resolveEntry = resolveEntry;
91
- exports.resolveOptions = resolveOptions;
@@ -1,23 +0,0 @@
1
- import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
2
- import { BuildOptions } from "esbuild";
3
-
4
- //#region src/helpers/resolve-options.d.ts
5
- declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
6
- /**
7
- * Resolves the entry options for esbuild.
8
- *
9
- * @param context - The build context.
10
- * @param entryPoints - The entry points to resolve.
11
- * @returns The resolved entry options.
12
- */
13
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
14
- /**
15
- * Resolves the esbuild options.
16
- *
17
- * @param context - The build context.
18
- * @returns The resolved esbuild options.
19
- */
20
- declare function resolveOptions(context: Context): BuildOptions;
21
- //#endregion
22
- export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
23
- //# sourceMappingURL=resolve-options.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.cts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;cA4Ba,sBAAA,EAAwB,OAAA,CAAQ,YAAA;;AAA7C;;;;;AAqBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;iBAsBa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
@@ -1,23 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
- import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
3
-
4
- //#region src/helpers/resolve-options.d.ts
5
- declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
6
- /**
7
- * Resolves the entry options for esbuild.
8
- *
9
- * @param context - The build context.
10
- * @param entryPoints - The entry points to resolve.
11
- * @returns The resolved entry options.
12
- */
13
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
14
- /**
15
- * Resolves the esbuild options.
16
- *
17
- * @param context - The build context.
18
- * @returns The resolved esbuild options.
19
- */
20
- declare function resolveOptions(context: Context): BuildOptions;
21
- //#endregion
22
- export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
23
- //# sourceMappingURL=resolve-options.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.mts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;cA4Ba,sBAAA,EAAwB,OAAA,CAAQ,YAAA;;AAA7C;;;;;AAqBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;iBAsBa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
@@ -1,87 +0,0 @@
1
- import defu from "defu";
2
- import { resolveEntryOutput } from "@powerlines/core/lib/entry";
3
- import { joinPaths } from "@stryke/path/join-paths";
4
- import { replaceExtension, replacePath } from "@stryke/path/replace";
5
- import { camelCase } from "@stryke/string-format/camel-case";
6
- import { isString } from "@stryke/type-checks/is-string";
7
-
8
- //#region src/helpers/resolve-options.ts
9
- const DEFAULT_ESBUILD_CONFIG = {
10
- target: "esnext",
11
- platform: "neutral",
12
- format: "esm",
13
- write: true,
14
- minify: true,
15
- sourcemap: false,
16
- bundle: true,
17
- treeShaking: true,
18
- keepNames: true,
19
- splitting: true,
20
- logLevel: "silent"
21
- };
22
- /**
23
- * Resolves the entry options for esbuild.
24
- *
25
- * @param context - The build context.
26
- * @param entryPoints - The entry points to resolve.
27
- * @returns The resolved entry options.
28
- */
29
- function resolveEntry(context, entryPoints = []) {
30
- return entryPoints.reduce((ret, entry) => {
31
- if (isString(entry)) ret[replaceExtension(replacePath(entry, context.config.root))] = replacePath(entry, context.config.root);
32
- else ret[entry.output || resolveEntryOutput(context, entry)] = entry.file;
33
- return ret;
34
- }, {});
35
- }
36
- /**
37
- * Resolves the esbuild options.
38
- *
39
- * @param context - The build context.
40
- * @returns The resolved esbuild options.
41
- */
42
- function resolveOptions(context) {
43
- if (context.config.inject && Object.keys(context.config.inject).length > 0) context.fs.writeSync(joinPaths(context.config.cwd, context.config.root, context.artifactsPath, "inject-shim.js"), Object.entries(context.config.inject).map(([key, value]) => {
44
- if (value) if (Array.isArray(value)) {
45
- if (camelCase(key) !== key) {
46
- if (value.length === 1) return `
47
- import ${camelCase(key)} from "${value[0]}";
48
- export { ${camelCase(key)} as "${key}" }`;
49
- else if (value.length > 1) return `
50
- import ${value[1] === "*" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from "${value[0]}";
51
- export { ${camelCase(key)} as "${key}" }`;
52
- } else if (value.length === 1) return `
53
- import ${key} from "${value[0]}";
54
- export { ${key} };`;
55
- else if (value.length > 1) return `
56
- import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
57
- export { ${key} };`;
58
- } else if (camelCase(key) !== key) return `
59
- import ${camelCase(key)} from "${value[0]}";
60
- export { ${camelCase(key)} as "${key}" }`;
61
- else return `
62
- import ${key} from "${value}";
63
- export { ${key} };`;
64
- return "";
65
- }).join("\n"));
66
- return defu({
67
- alias: context.alias,
68
- inject: context.config.inject && Object.keys(context.config.inject).length > 0 ? [joinPaths(context.config.cwd, context.config.root, context.artifactsPath, "inject-shim.js")] : void 0
69
- }, context.config?.esbuild ? context.config.esbuild : {}, {
70
- mainFields: context.config.resolve.mainFields,
71
- conditions: context.config.resolve.conditions,
72
- define: context.config.define,
73
- resolveExtensions: context.config.resolve.extensions,
74
- packages: context.config.resolve.skipNodeModulesBundle ? "external" : context.config?.esbuild ? (context.config?.esbuild).packages : "bundle",
75
- format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
76
- platform: context.config.platform,
77
- outdir: context.config.output.path,
78
- tsconfig: context.tsconfig.tsconfigFilePath,
79
- minify: context.config.output.minify,
80
- metafile: context.config.mode === "development",
81
- sourcemap: context.config.output.sourceMap
82
- }, DEFAULT_ESBUILD_CONFIG);
83
- }
84
-
85
- //#endregion
86
- export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
87
- //# sourceMappingURL=resolve-options.mjs.map