@powerlines/plugin-esbuild 0.13.378 → 0.13.380

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
27
27
 
28
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 />
29
29
 
30
- [![Version](https://img.shields.io/badge/version-0.13.352-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
30
+ [![Version](https://img.shields.io/badge/version-0.13.379-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://stormsoftware.com/projects/powerlines)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/powerlines/release.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
31
31
 
32
32
  <!-- prettier-ignore-start -->
33
33
  <!-- markdownlint-disable -->
@@ -21,10 +21,7 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
21
21
  async function bundle(context, file, overrides = {}) {
22
22
  const path = await context.fs.resolve(file);
23
23
  if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
24
- const ctx = await context.clone();
25
- ctx.config.resolve = (0, defu.default)(overrides.resolve ?? {}, { skipNodeModulesBundle: false }, ctx.config.resolve);
26
- ctx.config.esbuild = {
27
- ...ctx.config.esbuild ?? {},
24
+ const result = await (0, esbuild.build)((0, defu.default)({
28
25
  entryPoints: [path],
29
26
  write: false,
30
27
  sourcemap: false,
@@ -35,10 +32,10 @@ async function bundle(context, file, overrides = {}) {
35
32
  platform: "node",
36
33
  logLevel: "silent",
37
34
  ...(0, _stryke_helpers_omit.omit)(overrides, ["resolve"])
38
- };
39
- const result = await (0, esbuild.build)((0, defu.default)(require_helpers_resolve_options.resolveOptions(ctx), { plugins: [(0, unplugin.createEsbuildPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(ctx, {
35
+ }, require_helpers_resolve_options.resolveOptions(context), { plugins: [(0, unplugin.createEsbuildPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(context, {
40
36
  name: `${(0, _stryke_path_file_path_fns.findFileName)(file)} Bundler`,
41
- prefix: false
37
+ prefix: false,
38
+ overrides: (0, defu.default)(overrides.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve)
42
39
  }))({})] }));
43
40
  if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
44
41
  if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
@@ -1,10 +1,10 @@
1
1
  import { EsbuildOptions } from "../types/build.cjs";
2
- import { PluginContext, ResolveResolvedConfig } from "@powerlines/core";
2
+ import { PluginContext, ResolveOptions } from "@powerlines/core";
3
3
  import { OutputFile } from "esbuild";
4
4
 
5
5
  //#region src/helpers/bundle.d.ts
6
6
  type BundleOptions = Partial<EsbuildOptions> & {
7
- resolve?: Partial<ResolveResolvedConfig>;
7
+ resolve?: Partial<ResolveOptions>;
8
8
  };
9
9
  /**
10
10
  * Bundle a type definition to a module.
@@ -14,7 +14,7 @@ type BundleOptions = Partial<EsbuildOptions> & {
14
14
  * @param overrides - Optional overrides for the ESBuild configuration.
15
15
  * @returns A promise that resolves to the bundled module.
16
16
  */
17
- declare function bundle(context: PluginContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
17
+ declare function bundle<TContext extends PluginContext = PluginContext>(context: TContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
18
18
  declare type __ΩBundleOptions = any[];
19
19
  //#endregion
20
20
  export { BundleOptions, __ΩBundleOptions, bundle };
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KA4BY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,OAAA,GAAU,OAAA,CAAQ,qBAAA;AAAA;AADpB;;;;;;;;AAAA,iBAYsB,MAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
1
+ {"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KA4BY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA;AADpB;;;;;;;;AAAA,iBAYsB,MAAA,kBAAwB,aAAA,GAAgB,aAAA,CAAA,CAC5D,OAAA,EAAS,QAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
@@ -1,10 +1,10 @@
1
1
  import { EsbuildOptions } from "../types/build.mjs";
2
2
  import { OutputFile } from "esbuild";
3
- import { PluginContext, ResolveResolvedConfig } from "@powerlines/core";
3
+ import { PluginContext, ResolveOptions } from "@powerlines/core";
4
4
 
5
5
  //#region src/helpers/bundle.d.ts
6
6
  type BundleOptions = Partial<EsbuildOptions> & {
7
- resolve?: Partial<ResolveResolvedConfig>;
7
+ resolve?: Partial<ResolveOptions>;
8
8
  };
9
9
  /**
10
10
  * Bundle a type definition to a module.
@@ -14,7 +14,7 @@ type BundleOptions = Partial<EsbuildOptions> & {
14
14
  * @param overrides - Optional overrides for the ESBuild configuration.
15
15
  * @returns A promise that resolves to the bundled module.
16
16
  */
17
- declare function bundle(context: PluginContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
17
+ declare function bundle<TContext extends PluginContext = PluginContext>(context: TContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
18
18
  declare type __ΩBundleOptions = any[];
19
19
  //#endregion
20
20
  export { BundleOptions, __ΩBundleOptions, bundle };
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KA4BY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,OAAA,GAAU,OAAA,CAAQ,qBAAA;AAAA;AADpB;;;;;;;;AAAA,iBAYsB,MAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
1
+ {"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;KA4BY,aAAA,GAAgB,OAAA,CAAQ,cAAA;EAClC,OAAA,GAAU,OAAA,CAAQ,cAAA;AAAA;AADpB;;;;;;;;AAAA,iBAYsB,MAAA,kBAAwB,aAAA,GAAgB,aAAA,CAAA,CAC5D,OAAA,EAAS,QAAA,EACT,IAAA,UACA,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,UAAA;AAAA"}
@@ -18,10 +18,7 @@ import { findFileName } from "@stryke/path/file-path-fns";
18
18
  async function bundle(context, file, overrides = {}) {
19
19
  const path = await context.fs.resolve(file);
20
20
  if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
21
- const ctx = await context.clone();
22
- ctx.config.resolve = defu(overrides.resolve ?? {}, { skipNodeModulesBundle: false }, ctx.config.resolve);
23
- ctx.config.esbuild = {
24
- ...ctx.config.esbuild ?? {},
21
+ const result = await build(defu({
25
22
  entryPoints: [path],
26
23
  write: false,
27
24
  sourcemap: false,
@@ -32,10 +29,10 @@ async function bundle(context, file, overrides = {}) {
32
29
  platform: "node",
33
30
  logLevel: "silent",
34
31
  ...omit(overrides, ["resolve"])
35
- };
36
- const result = await build(defu(resolveOptions(ctx), { plugins: [createEsbuildPlugin(createUnpluginResolver(ctx, {
32
+ }, resolveOptions(context), { plugins: [createEsbuildPlugin(createUnpluginResolver(context, {
37
33
  name: `${findFileName(file)} Bundler`,
38
- prefix: false
34
+ prefix: false,
35
+ overrides: defu(overrides.resolve ?? {}, { skipNodeModulesBundle: false }, context.config.resolve)
39
36
  }))({})] }));
40
37
  if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
41
38
  if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.mjs","names":[],"sources":["../../src/helpers/bundle.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 type { PluginContext, ResolveResolvedConfig } from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { EsbuildOptions, EsbuildPluginContext } from \"../types\";\nimport { resolveOptions } from \"./resolve-options\";\n\nexport type BundleOptions = Partial<EsbuildOptions> & {\n resolve?: Partial<ResolveResolvedConfig>;\n};\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle(\n context: PluginContext,\n file: string,\n overrides: BundleOptions = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const ctx = (await context.clone()) as EsbuildPluginContext;\n\n ctx.config.resolve = defu(\n overrides.resolve ?? {},\n { skipNodeModulesBundle: false },\n ctx.config.resolve\n ) as ResolveResolvedConfig;\n ctx.config.esbuild = {\n ...(ctx.config.esbuild ?? {}),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: true,\n bundle: true,\n packages: \"bundle\",\n platform: \"node\",\n logLevel: \"silent\",\n ...omit(overrides, [\"resolve\"])\n } as BuildOptions;\n\n const result = await build(\n defu(resolveOptions(ctx), {\n plugins: [\n createEsbuildPlugin(\n createUnpluginResolver(ctx, {\n name: `${findFileName(file)} Bundler`,\n prefix: false\n })\n )({})\n ]\n })\n );\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to bundle ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.warn(\n `Warnings while bundling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,eAAsB,OACpB,SACA,MACA,YAA2B,EAAE,EACR;CACrB,MAAM,OAAO,MAAM,QAAQ,GAAG,QAAQ,KAAK;AAC3C,KAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,WAAW,KAAK,CACvC,OAAM,IAAI,MACR,sBAAsB,KAAK,yCAC5B;CAGH,MAAM,MAAO,MAAM,QAAQ,OAAO;AAElC,KAAI,OAAO,UAAU,KACnB,UAAU,WAAW,EAAE,EACvB,EAAE,uBAAuB,OAAO,EAChC,IAAI,OAAO,QACZ;AACD,KAAI,OAAO,UAAU;EACnB,GAAI,IAAI,OAAO,WAAW,EAAE;EAC5B,aAAa,CAAC,KAAK;EACnB,OAAO;EACP,WAAW;EACX,WAAW;EACX,aAAa;EACb,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,GAAG,KAAK,WAAW,CAAC,UAAU,CAAC;EAChC;CAED,MAAM,SAAS,MAAM,MACnB,KAAK,eAAe,IAAI,EAAE,EACxB,SAAS,CACP,oBACE,uBAAuB,KAAK;EAC1B,MAAM,GAAG,aAAa,KAAK,CAAC;EAC5B,QAAQ;EACT,CAAC,CACH,CAAC,EAAE,CAAC,CACN,EACF,CAAC,CACH;AACD,KAAI,OAAO,OAAO,SAAS,EACzB,OAAM,IAAI,MACR,oBAAoB,KAAK,IAAI,OAAO,OACjC,KAAI,UAAS,MAAM,KAAK,CACxB,KAAK,KAAK,GACd;AAEH,KAAI,OAAO,SAAS,SAAS,EAC3B,SAAQ,KACN,2BAA2B,KAAK,IAAI,OAAO,SACxC,KAAI,YAAW,QAAQ,KAAK,CAC5B,KAAK,KAAK,GACd;AAEH,KAAI,CAAC,OAAO,eAAe,OAAO,YAAY,OAAO,QAAQ,CAAC,WAAW,EACvE,OAAM,IAAI,MACR,iCACE,KACD,iDACF;AAGH,QAAO,OAAO,YAAY,OAAO,QAAQ,CAAC"}
1
+ {"version":3,"file":"bundle.mjs","names":[],"sources":["../../src/helpers/bundle.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 type { PluginContext, ResolveOptions } from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport { build, OutputFile } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\nimport { EsbuildOptions } from \"../types\";\nimport { resolveOptions } from \"./resolve-options\";\n\nexport type BundleOptions = Partial<EsbuildOptions> & {\n resolve?: Partial<ResolveOptions>;\n};\n\n/**\n * Bundle a type definition to a module.\n *\n * @param context - The context object containing the environment paths.\n * @param file - The file path to bundle.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the bundled module.\n */\nexport async function bundle<TContext extends PluginContext = PluginContext>(\n context: TContext,\n file: string,\n overrides: BundleOptions = {}\n): Promise<OutputFile> {\n const path = await context.fs.resolve(file);\n if (!path || !context.fs.existsSync(path)) {\n throw new Error(\n `Module not found: \"${file}\". Please check the path and try again.`\n );\n }\n\n const result = await build(\n defu(\n {\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: true,\n bundle: true,\n packages: \"bundle\",\n platform: \"node\",\n logLevel: \"silent\",\n ...omit(overrides, [\"resolve\"])\n },\n resolveOptions(context),\n {\n plugins: [\n createEsbuildPlugin(\n createUnpluginResolver(context, {\n name: `${findFileName(file)} Bundler`,\n prefix: false,\n overrides: defu(\n overrides.resolve ?? {},\n { skipNodeModulesBundle: false },\n context.config.resolve\n ) as ResolveOptions\n })\n )({})\n ]\n }\n )\n );\n if (result.errors.length > 0) {\n throw new Error(\n `Failed to bundle ${file}: ${result.errors\n .map(error => error.text)\n .join(\", \")}`\n );\n }\n if (result.warnings.length > 0) {\n context.warn(\n `Warnings while bundling ${file}: ${result.warnings\n .map(warning => warning.text)\n .join(\", \")}`\n );\n }\n if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) {\n throw new Error(\n `No output files generated for ${\n file\n }. Please check the configuration and try again.`\n );\n }\n\n return result.outputFiles.filter(Boolean)[0]!;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,eAAsB,OACpB,SACA,MACA,YAA2B,EAAE,EACR;CACrB,MAAM,OAAO,MAAM,QAAQ,GAAG,QAAQ,KAAK;AAC3C,KAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,WAAW,KAAK,CACvC,OAAM,IAAI,MACR,sBAAsB,KAAK,yCAC5B;CAGH,MAAM,SAAS,MAAM,MACnB,KACE;EACE,aAAa,CAAC,KAAK;EACnB,OAAO;EACP,WAAW;EACX,WAAW;EACX,aAAa;EACb,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,GAAG,KAAK,WAAW,CAAC,UAAU,CAAC;EAChC,EACD,eAAe,QAAQ,EACvB,EACE,SAAS,CACP,oBACE,uBAAuB,SAAS;EAC9B,MAAM,GAAG,aAAa,KAAK,CAAC;EAC5B,QAAQ;EACR,WAAW,KACT,UAAU,WAAW,EAAE,EACvB,EAAE,uBAAuB,OAAO,EAChC,QAAQ,OAAO,QAChB;EACF,CAAC,CACH,CAAC,EAAE,CAAC,CACN,EACF,CACF,CACF;AACD,KAAI,OAAO,OAAO,SAAS,EACzB,OAAM,IAAI,MACR,oBAAoB,KAAK,IAAI,OAAO,OACjC,KAAI,UAAS,MAAM,KAAK,CACxB,KAAK,KAAK,GACd;AAEH,KAAI,OAAO,SAAS,SAAS,EAC3B,SAAQ,KACN,2BAA2B,KAAK,IAAI,OAAO,SACxC,KAAI,YAAW,QAAQ,KAAK,CAC5B,KAAK,KAAK,GACd;AAEH,KAAI,CAAC,OAAO,eAAe,OAAO,YAAY,OAAO,QAAQ,CAAC,WAAW,EACvE,OAAM,IAAI,MACR,iCACE,KACD,iDACF;AAGH,QAAO,OAAO,YAAY,OAAO,QAAQ,CAAC"}
@@ -13,7 +13,7 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
13
13
  * @param overrides - Optional overrides for the ESBuild configuration.
14
14
  * @returns A promise that resolves to the compiled module.
15
15
  */
16
- async function resolveModule(context, type, overrides = {}) {
16
+ async function resolveModule(context, type, overrides) {
17
17
  let typeDefinition;
18
18
  if ((0, _stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(type);
19
19
  else typeDefinition = type;
@@ -47,7 +47,7 @@ ${result.text}` : ""}`);
47
47
  * @param overrides - Optional overrides for the ESBuild configuration.
48
48
  * @returns A promise that resolves to the compiled module.
49
49
  */
50
- async function resolve(context, type, overrides = {}) {
50
+ async function resolve(context, type, overrides) {
51
51
  let typeDefinition;
52
52
  if ((0, _stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(type);
53
53
  else typeDefinition = type;
@@ -1,6 +1,5 @@
1
1
  import { BundleOptions } from "./bundle.cjs";
2
2
  import { PluginContext } from "@powerlines/core";
3
- import { BuildOptions } from "esbuild";
4
3
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
5
4
 
6
5
  //#region src/helpers/resolve.d.ts
@@ -12,7 +11,7 @@ import { TypeDefinitionParameter } from "@stryke/types/configuration";
12
11
  * @param overrides - Optional overrides for the ESBuild configuration.
13
12
  * @returns A promise that resolves to the compiled module.
14
13
  */
15
- declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
14
+ declare function resolveModule<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
16
15
  /**
17
16
  * Compiles a type definition to a module and returns the specified export from the module.
18
17
  *
@@ -21,7 +20,7 @@ declare function resolveModule<TResult>(context: PluginContext, type: TypeDefini
21
20
  * @param overrides - Optional overrides for the ESBuild configuration.
22
21
  * @returns A promise that resolves to the compiled module.
23
22
  */
24
- declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
23
+ declare function resolve<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
25
24
  //#endregion
26
25
  export { resolve, resolveModule };
27
26
  //# sourceMappingURL=resolve.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.cts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":";;;;;;;;AAoCA;;;;;;iBAAsB,aAAA,SAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,OAAA;;;;;;;;;iBAqEW,OAAA,SAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAW,OAAA,CAAQ,YAAA,IAClB,OAAA,CAAQ,OAAA"}
1
+ {"version":3,"file":"resolve.d.cts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":";;;;;;;AAmCA;;;;;;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,5 +1,4 @@
1
1
  import { BundleOptions } from "./bundle.mjs";
2
- import { BuildOptions } from "esbuild";
3
2
  import { PluginContext } from "@powerlines/core";
4
3
  import { TypeDefinitionParameter } from "@stryke/types/configuration";
5
4
 
@@ -12,7 +11,7 @@ import { TypeDefinitionParameter } from "@stryke/types/configuration";
12
11
  * @param overrides - Optional overrides for the ESBuild configuration.
13
12
  * @returns A promise that resolves to the compiled module.
14
13
  */
15
- declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
14
+ declare function resolveModule<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
16
15
  /**
17
16
  * Compiles a type definition to a module and returns the specified export from the module.
18
17
  *
@@ -21,7 +20,7 @@ declare function resolveModule<TResult>(context: PluginContext, type: TypeDefini
21
20
  * @param overrides - Optional overrides for the ESBuild configuration.
22
21
  * @returns A promise that resolves to the compiled module.
23
22
  */
24
- declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
23
+ declare function resolve<TResult, TContext extends PluginContext = PluginContext>(context: TContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
25
24
  //#endregion
26
25
  export { resolve, resolveModule };
27
26
  //# sourceMappingURL=resolve.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.d.mts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":";;;;;;;;AAoCA;;;;;;iBAAsB,aAAA,SAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAW,aAAA,GACV,OAAA,CAAQ,OAAA;;;;;;;;;iBAqEW,OAAA,SAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,uBAAA,EACN,SAAA,GAAW,OAAA,CAAQ,YAAA,IAClB,OAAA,CAAQ,OAAA"}
1
+ {"version":3,"file":"resolve.d.mts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":";;;;;;;AAmCA;;;;;;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"}
@@ -11,7 +11,7 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
11
11
  * @param overrides - Optional overrides for the ESBuild configuration.
12
12
  * @returns A promise that resolves to the compiled module.
13
13
  */
14
- async function resolveModule(context, type, overrides = {}) {
14
+ async function resolveModule(context, type, overrides) {
15
15
  let typeDefinition;
16
16
  if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
17
17
  else typeDefinition = type;
@@ -45,7 +45,7 @@ ${result.text}` : ""}`);
45
45
  * @param overrides - Optional overrides for the ESBuild configuration.
46
46
  * @returns A promise that resolves to the compiled module.
47
47
  */
48
- async function resolve(context, type, overrides = {}) {
48
+ async function resolve(context, type, overrides) {
49
49
  let typeDefinition;
50
50
  if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
51
51
  else typeDefinition = type;
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.mjs","names":[],"sources":["../../src/helpers/resolve.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 { PluginContext } from \"@powerlines/core\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { BuildOptions } from \"esbuild\";\nimport { bundle, BundleOptions } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module and returns the module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolveModule<TResult>(\n context: PluginContext,\n type: TypeDefinitionParameter,\n overrides: BundleOptions = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle(context, typeDefinition.file, overrides);\n\n let resolved: any;\n try {\n resolved = await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n });\n } catch (error) {\n if (\n isSetString((error as Error).message) &&\n new RegExp(\n `Cannot find module '${context.config.framework || \"powerlines\"}:.*'`\n ).test((error as Error).message)\n ) {\n const moduleName = (error as Error).message.match(\n new RegExp(\n `Cannot find module '(${context.config.framework || \"powerlines\"}:.*)'`\n )\n )?.[1];\n throw new Error(\n `The module \"${moduleName}\" could not be resolved while evaluating \"${\n typeDefinition.file\n }\". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${\n context.config.logLevel === \"debug\" ||\n context.config.logLevel === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n throw new Error(\n `Failed to evaluate the bundled module for \"${\n typeDefinition.file\n }\". Error: ${(error as Error).message}${\n context.config.logLevel === \"debug\" ||\n context.config.logLevel === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n return resolved;\n}\n\n/**\n * Compiles a type definition to a module and returns the specified export from the module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<TResult>(\n context: PluginContext,\n type: TypeDefinitionParameter,\n overrides: Partial<BuildOptions> = {}\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const resolved = await resolveModule<Record<string, any>>(\n context,\n typeDefinition,\n overrides\n );\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];\n if (resolvedExport === undefined) {\n throw new Error(\n `The export \"${exportName}\" could not be resolved in the \"${\n typeDefinition.file\n }\" module. ${\n Object.keys(resolved).length === 0\n ? `After bundling, no exports were found in the module. Please ensure that the \"${\n typeDefinition.file\n }\" module has a \"${exportName}\" export with the desired value.`\n : `After bundling, the available exports were: ${Object.keys(\n resolved\n ).join(\n \", \"\n )}. Please ensure that the export exists and is correctly named.`\n }`\n );\n }\n\n return resolvedExport;\n}\n"],"mappings":";;;;;;;;;;;;;AAoCA,eAAsB,cACpB,SACA,MACA,YAA2B,EAAE,EACX;CAClB,IAAI;AACJ,KAAI,YAAY,KAAK,CACnB,kBAAiB,oBAAoB,KAAK;KAE1C,kBAAiB;CAGnB,MAAM,SAAS,MAAM,OAAO,SAAS,eAAe,MAAM,UAAU;CAEpE,IAAI;AACJ,KAAI;AACF,aAAW,MAAM,QAAQ,SAAS,WAAW,OAAO,MAAM;GACxD,UAAU,OAAO;GACjB,gBAAgB;GACjB,CAAC;UACK,OAAO;AACd,MACE,YAAa,MAAgB,QAAQ,IACrC,IAAI,OACF,uBAAuB,QAAQ,OAAO,aAAa,aAAa,MACjE,CAAC,KAAM,MAAgB,QAAQ,EAChC;GACA,MAAM,aAAc,MAAgB,QAAQ,MAC1C,IAAI,OACF,wBAAwB,QAAQ,OAAO,aAAa,aAAa,OAClE,CACF,GAAG;AACJ,SAAM,IAAI,MACR,eAAe,WAAW,4CACxB,eAAe,KAChB,uHACC,QAAQ,OAAO,aAAa,WAC5B,QAAQ,OAAO,aAAa,UACxB;;;EAGZ,OAAO,SACK,KAEP;;AAGH,QAAM,IAAI,MACR,8CACE,eAAe,KAChB,YAAa,MAAgB,UAC5B,QAAQ,OAAO,aAAa,WAC5B,QAAQ,OAAO,aAAa,UACxB;;;EAGV,OAAO,SACG,KAEP;;AAGH,QAAO;;;;;;;;;;AAWT,eAAsB,QACpB,SACA,MACA,YAAmC,EAAE,EACnB;CAClB,IAAI;AACJ,KAAI,YAAY,KAAK,CACnB,kBAAiB,oBAAoB,KAAK;KAE1C,kBAAiB;CAGnB,MAAM,WAAW,MAAM,cACrB,SACA,gBACA,UACD;CAED,IAAI,aAAa,eAAe;AAChC,KAAI,CAAC,WACH,cAAa;CAGf,MAAM,iBAAiB,SAAS,eAAe,SAAS,MAAM;AAC9D,KAAI,mBAAmB,OACrB,OAAM,IAAI,MACR,eAAe,WAAW,kCACxB,eAAe,KAChB,YACC,OAAO,KAAK,SAAS,CAAC,WAAW,IAC7B,gFACE,eAAe,KAChB,kBAAkB,WAAW,oCAC9B,+CAA+C,OAAO,KACpD,SACD,CAAC,KACA,KACD,CAAC,kEAET;AAGH,QAAO"}
1
+ {"version":3,"file":"resolve.mjs","names":[],"sources":["../../src/helpers/resolve.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 { PluginContext } from \"@powerlines/core\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { bundle, BundleOptions } from \"./bundle\";\n\n/**\n * Compiles a type definition to a module and returns the module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolveModule<\n TResult,\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n type: TypeDefinitionParameter,\n overrides?: BundleOptions\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const result = await bundle<TContext>(\n context,\n typeDefinition.file,\n overrides\n );\n\n let resolved: any;\n try {\n resolved = await context.resolver.evalModule(result.text, {\n filename: result.path,\n forceTranspile: true\n });\n } catch (error) {\n if (\n isSetString((error as Error).message) &&\n new RegExp(\n `Cannot find module '${context.config.framework || \"powerlines\"}:.*'`\n ).test((error as Error).message)\n ) {\n const moduleName = (error as Error).message.match(\n new RegExp(\n `Cannot find module '(${context.config.framework || \"powerlines\"}:.*)'`\n )\n )?.[1];\n throw new Error(\n `The module \"${moduleName}\" could not be resolved while evaluating \"${\n typeDefinition.file\n }\". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${\n context.config.logLevel === \"debug\" ||\n context.config.logLevel === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n throw new Error(\n `Failed to evaluate the bundled module for \"${\n typeDefinition.file\n }\". Error: ${(error as Error).message}${\n context.config.logLevel === \"debug\" ||\n context.config.logLevel === \"trace\"\n ? `\n\nBundle output for module:\n${result.text}`\n : \"\"\n }`\n );\n }\n\n return resolved;\n}\n\n/**\n * Compiles a type definition to a module and returns the specified export from the module.\n *\n * @param context - The context object containing the environment paths.\n * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.\n * @param overrides - Optional overrides for the ESBuild configuration.\n * @returns A promise that resolves to the compiled module.\n */\nexport async function resolve<\n TResult,\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n type: TypeDefinitionParameter,\n overrides?: BundleOptions\n): Promise<TResult> {\n let typeDefinition!: TypeDefinition;\n if (isSetString(type)) {\n typeDefinition = parseTypeDefinition(type) as TypeDefinition;\n } else {\n typeDefinition = type;\n }\n\n const resolved = await resolveModule<Record<string, any>, TContext>(\n context,\n typeDefinition,\n overrides\n );\n\n let exportName = typeDefinition.name;\n if (!exportName) {\n exportName = \"default\";\n }\n\n const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];\n if (resolvedExport === undefined) {\n throw new Error(\n `The export \"${exportName}\" could not be resolved in the \"${\n typeDefinition.file\n }\" module. ${\n Object.keys(resolved).length === 0\n ? `After bundling, no exports were found in the module. Please ensure that the \"${\n typeDefinition.file\n }\" module has a \"${exportName}\" export with the desired value.`\n : `After bundling, the available exports were: ${Object.keys(\n resolved\n ).join(\n \", \"\n )}. Please ensure that the export exists and is correctly named.`\n }`\n );\n }\n\n return resolvedExport;\n}\n"],"mappings":";;;;;;;;;;;;;AAmCA,eAAsB,cAIpB,SACA,MACA,WACkB;CAClB,IAAI;AACJ,KAAI,YAAY,KAAK,CACnB,kBAAiB,oBAAoB,KAAK;KAE1C,kBAAiB;CAGnB,MAAM,SAAS,MAAM,OACnB,SACA,eAAe,MACf,UACD;CAED,IAAI;AACJ,KAAI;AACF,aAAW,MAAM,QAAQ,SAAS,WAAW,OAAO,MAAM;GACxD,UAAU,OAAO;GACjB,gBAAgB;GACjB,CAAC;UACK,OAAO;AACd,MACE,YAAa,MAAgB,QAAQ,IACrC,IAAI,OACF,uBAAuB,QAAQ,OAAO,aAAa,aAAa,MACjE,CAAC,KAAM,MAAgB,QAAQ,EAChC;GACA,MAAM,aAAc,MAAgB,QAAQ,MAC1C,IAAI,OACF,wBAAwB,QAAQ,OAAO,aAAa,aAAa,OAClE,CACF,GAAG;AACJ,SAAM,IAAI,MACR,eAAe,WAAW,4CACxB,eAAe,KAChB,uHACC,QAAQ,OAAO,aAAa,WAC5B,QAAQ,OAAO,aAAa,UACxB;;;EAGZ,OAAO,SACK,KAEP;;AAGH,QAAM,IAAI,MACR,8CACE,eAAe,KAChB,YAAa,MAAgB,UAC5B,QAAQ,OAAO,aAAa,WAC5B,QAAQ,OAAO,aAAa,UACxB;;;EAGV,OAAO,SACG,KAEP;;AAGH,QAAO;;;;;;;;;;AAWT,eAAsB,QAIpB,SACA,MACA,WACkB;CAClB,IAAI;AACJ,KAAI,YAAY,KAAK,CACnB,kBAAiB,oBAAoB,KAAK;KAE1C,kBAAiB;CAGnB,MAAM,WAAW,MAAM,cACrB,SACA,gBACA,UACD;CAED,IAAI,aAAa,eAAe;AAChC,KAAI,CAAC,WACH,cAAa;CAGf,MAAM,iBAAiB,SAAS,eAAe,SAAS,MAAM;AAC9D,KAAI,mBAAmB,OACrB,OAAM,IAAI,MACR,eAAe,WAAW,kCACxB,eAAe,KAChB,YACC,OAAO,KAAK,SAAS,CAAC,WAAW,IAC7B,gFACE,eAAe,KAChB,kBAAkB,WAAW,oCAC9B,+CAA+C,OAAO,KACpD,SACD,CAAC,KACA,KACD,CAAC,kEAET;AAGH,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-esbuild",
3
- "version": "0.13.378",
3
+ "version": "0.13.380",
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"],
@@ -83,16 +83,16 @@
83
83
  "peerDependencies": { "esbuild": ">=0.27.3" },
84
84
  "peerDependenciesMeta": { "esbuild": { "optional": false } },
85
85
  "dependencies": {
86
- "@powerlines/core": "^0.10.1",
87
- "@stryke/fs": "^0.33.63",
88
- "@stryke/path": "^0.27.2",
89
- "@stryke/type-checks": "^0.5.41",
90
- "@stryke/types": "^0.11.1",
86
+ "@powerlines/core": "^0.12.0",
87
+ "@stryke/fs": "^0.33.64",
88
+ "@stryke/path": "^0.27.3",
89
+ "@stryke/type-checks": "^0.6.0",
90
+ "@stryke/types": "^0.11.2",
91
91
  "defu": "^6.1.4",
92
92
  "jiti": "^2.6.1",
93
93
  "unplugin": "^3.0.0"
94
94
  },
95
95
  "devDependencies": { "esbuild": "^0.27.4", "@types/node": "^25.5.0" },
96
96
  "publishConfig": { "access": "public" },
97
- "gitHead": "016be94e1a1c1967aaacab611fde6cd1c8e14e28"
97
+ "gitHead": "c0cb55f77d02626e594888d7c34bca5f0fb8b337"
98
98
  }