@powerlines/plugin-esbuild 0.13.377 → 0.13.378
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/dist/helpers/bundle.d.cts +8 -5
- package/dist/helpers/bundle.d.cts.map +1 -1
- package/dist/helpers/bundle.d.mts +8 -5
- package/dist/helpers/bundle.d.mts.map +1 -1
- package/dist/helpers/bundle.mjs.map +1 -1
- package/dist/helpers/index.d.cts +2 -2
- package/dist/helpers/index.d.mts +2 -2
- package/dist/helpers/resolve.cjs +2 -2
- package/dist/helpers/resolve.d.cts +2 -1
- package/dist/helpers/resolve.d.cts.map +1 -1
- package/dist/helpers/resolve.d.mts +2 -1
- package/dist/helpers/resolve.d.mts.map +1 -1
- package/dist/helpers/resolve.mjs +1 -1
- package/dist/helpers/resolve.mjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/package.json +2 -2
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { EsbuildOptions } from "../types/build.cjs";
|
|
1
2
|
import { PluginContext, ResolveResolvedConfig } from "@powerlines/core";
|
|
2
|
-
import {
|
|
3
|
+
import { OutputFile } from "esbuild";
|
|
3
4
|
|
|
4
5
|
//#region src/helpers/bundle.d.ts
|
|
6
|
+
type BundleOptions = Partial<EsbuildOptions> & {
|
|
7
|
+
resolve?: Partial<ResolveResolvedConfig>;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* Bundle a type definition to a module.
|
|
7
11
|
*
|
|
@@ -10,9 +14,8 @@ import { BuildOptions, OutputFile } from "esbuild";
|
|
|
10
14
|
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
11
15
|
* @returns A promise that resolves to the bundled module.
|
|
12
16
|
*/
|
|
13
|
-
declare function bundle(context: PluginContext, file: string, overrides?:
|
|
14
|
-
|
|
15
|
-
}): Promise<OutputFile>;
|
|
17
|
+
declare function bundle(context: PluginContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
|
|
18
|
+
declare type __ΩBundleOptions = any[];
|
|
16
19
|
//#endregion
|
|
17
|
-
export { bundle };
|
|
20
|
+
export { BundleOptions, __ΩBundleOptions, bundle };
|
|
18
21
|
//# sourceMappingURL=bundle.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":"
|
|
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,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EsbuildOptions } from "../types/build.mjs";
|
|
2
|
+
import { OutputFile } from "esbuild";
|
|
2
3
|
import { PluginContext, ResolveResolvedConfig } from "@powerlines/core";
|
|
3
4
|
|
|
4
5
|
//#region src/helpers/bundle.d.ts
|
|
6
|
+
type BundleOptions = Partial<EsbuildOptions> & {
|
|
7
|
+
resolve?: Partial<ResolveResolvedConfig>;
|
|
8
|
+
};
|
|
5
9
|
/**
|
|
6
10
|
* Bundle a type definition to a module.
|
|
7
11
|
*
|
|
@@ -10,9 +14,8 @@ import { PluginContext, ResolveResolvedConfig } from "@powerlines/core";
|
|
|
10
14
|
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
11
15
|
* @returns A promise that resolves to the bundled module.
|
|
12
16
|
*/
|
|
13
|
-
declare function bundle(context: PluginContext, file: string, overrides?:
|
|
14
|
-
|
|
15
|
-
}): Promise<OutputFile>;
|
|
17
|
+
declare function bundle(context: PluginContext, file: string, overrides?: BundleOptions): Promise<OutputFile>;
|
|
18
|
+
declare type __ΩBundleOptions = any[];
|
|
16
19
|
//#endregion
|
|
17
|
-
export { bundle };
|
|
20
|
+
export { BundleOptions, __ΩBundleOptions, bundle };
|
|
18
21
|
//# sourceMappingURL=bundle.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":"
|
|
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 +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 { EsbuildPluginContext } from \"../types\";\nimport { resolveOptions } from \"./resolve-options\";\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:
|
|
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"}
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bundle } from "./bundle.cjs";
|
|
1
|
+
import { BundleOptions, __ΩBundleOptions, bundle } from "./bundle.cjs";
|
|
2
2
|
import { resolve, resolveModule } from "./resolve.cjs";
|
|
3
3
|
import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./resolve-options.cjs";
|
|
4
4
|
import { createEsbuildPlugin } from "./unplugin.cjs";
|
|
5
|
-
export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
5
|
+
export { BundleOptions, DEFAULT_ESBUILD_CONFIG, __ΩBundleOptions, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bundle } from "./bundle.mjs";
|
|
1
|
+
import { BundleOptions, __ΩBundleOptions, bundle } from "./bundle.mjs";
|
|
2
2
|
import { resolve, resolveModule } from "./resolve.mjs";
|
|
3
3
|
import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./resolve-options.mjs";
|
|
4
4
|
import { createEsbuildPlugin } from "./unplugin.mjs";
|
|
5
|
-
export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
5
|
+
export { BundleOptions, DEFAULT_ESBUILD_CONFIG, __ΩBundleOptions, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
package/dist/helpers/resolve.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
|
|
3
|
+
const require_helpers_bundle = require('./bundle.cjs');
|
|
4
4
|
let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
5
5
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ 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;
|
|
20
|
-
const result = await
|
|
20
|
+
const result = await require_helpers_bundle.bundle(context, typeDefinition.file, overrides);
|
|
21
21
|
let resolved;
|
|
22
22
|
try {
|
|
23
23
|
resolved = await context.resolver.evalModule(result.text, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BundleOptions } from "./bundle.cjs";
|
|
1
2
|
import { PluginContext } from "@powerlines/core";
|
|
2
3
|
import { BuildOptions } from "esbuild";
|
|
3
4
|
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
@@ -11,7 +12,7 @@ import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
|
11
12
|
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
13
|
* @returns A promise that resolves to the compiled module.
|
|
13
14
|
*/
|
|
14
|
-
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?:
|
|
15
|
+
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
|
|
15
16
|
/**
|
|
16
17
|
* Compiles a type definition to a module and returns the specified export from the module.
|
|
17
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.cts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":"
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import { BundleOptions } from "./bundle.mjs";
|
|
1
2
|
import { BuildOptions } from "esbuild";
|
|
2
3
|
import { PluginContext } from "@powerlines/core";
|
|
3
4
|
import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
@@ -11,7 +12,7 @@ import { TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
|
11
12
|
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
13
|
* @returns A promise that resolves to the compiled module.
|
|
13
14
|
*/
|
|
14
|
-
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?:
|
|
15
|
+
declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: BundleOptions): Promise<TResult>;
|
|
15
16
|
/**
|
|
16
17
|
* Compiles a type definition to a module and returns the specified export from the module.
|
|
17
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.mts","names":[],"sources":["../../src/helpers/resolve.ts"],"mappings":"
|
|
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"}
|
package/dist/helpers/resolve.mjs
CHANGED
|
@@ -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 {
|
|
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"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { bundle } from "./helpers/bundle.cjs";
|
|
2
|
-
import { resolve, resolveModule } from "./helpers/resolve.cjs";
|
|
3
|
-
import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.cjs";
|
|
4
1
|
import { EsbuildOptions, __ΩEsbuildOptions } from "./types/build.cjs";
|
|
5
2
|
import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import { BundleOptions, __ΩBundleOptions, bundle } from "./helpers/bundle.cjs";
|
|
4
|
+
import { resolve, resolveModule } from "./helpers/resolve.cjs";
|
|
5
|
+
import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.cjs";
|
|
6
6
|
import { createEsbuildPlugin } from "./helpers/unplugin.cjs";
|
|
7
7
|
import { Plugin } from "@powerlines/core";
|
|
8
8
|
|
|
@@ -17,5 +17,5 @@ declare module "@powerlines/core" {
|
|
|
17
17
|
*/
|
|
18
18
|
declare const plugin: <TContext extends EsbuildPluginContext = EsbuildPluginContext>(options?: EsbuildPluginOptions) => Plugin<TContext>;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { DEFAULT_ESBUILD_CONFIG, EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
20
|
+
export { BundleOptions, DEFAULT_ESBUILD_CONFIG, EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩBundleOptions, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
21
21
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { bundle } from "./helpers/bundle.mjs";
|
|
2
|
-
import { resolve, resolveModule } from "./helpers/resolve.mjs";
|
|
3
|
-
import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.mjs";
|
|
4
1
|
import { EsbuildOptions, __ΩEsbuildOptions } from "./types/build.mjs";
|
|
5
2
|
import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __Ω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
6
|
import { createEsbuildPlugin } from "./helpers/unplugin.mjs";
|
|
7
7
|
import { Plugin } from "@powerlines/core";
|
|
8
8
|
|
|
@@ -17,5 +17,5 @@ declare module "@powerlines/core" {
|
|
|
17
17
|
*/
|
|
18
18
|
declare const plugin: <TContext extends EsbuildPluginContext = EsbuildPluginContext>(options?: EsbuildPluginOptions) => Plugin<TContext>;
|
|
19
19
|
//#endregion
|
|
20
|
-
export { DEFAULT_ESBUILD_CONFIG, EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
20
|
+
export { BundleOptions, DEFAULT_ESBUILD_CONFIG, EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩBundleOptions, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
21
21
|
//# sourceMappingURL=index.d.mts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-esbuild",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.378",
|
|
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"],
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": { "esbuild": "^0.27.4", "@types/node": "^25.5.0" },
|
|
96
96
|
"publishConfig": { "access": "public" },
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "016be94e1a1c1967aaacab611fde6cd1c8e14e28"
|
|
98
98
|
}
|