@powerlines/plugin-esbuild 0.13.307 → 0.13.308
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/build-Br4iCJ5d.d.cts +8 -0
- package/dist/build-Br4iCJ5d.d.cts.map +1 -0
- package/dist/build-CQpSv6Qa.cjs +0 -0
- package/dist/build-CrohITJo.d.mts +8 -0
- package/dist/build-CrohITJo.d.mts.map +1 -0
- package/dist/build-DfzG3fLI.mjs +1 -0
- package/dist/bundle-Bx7Mimeh.d.cts +17 -0
- package/dist/bundle-Bx7Mimeh.d.cts.map +1 -0
- package/dist/bundle-D6QqCoyO.mjs +41 -0
- package/dist/bundle-D6QqCoyO.mjs.map +1 -0
- package/dist/bundle-DG12gVtZ.cjs +46 -0
- package/dist/bundle-UTFhPSjU.d.mts +17 -0
- package/dist/bundle-UTFhPSjU.d.mts.map +1 -0
- package/dist/helpers/bundle.cjs +3 -42
- package/dist/helpers/bundle.d.cts +2 -17
- package/dist/helpers/bundle.d.mts +2 -17
- package/dist/helpers/bundle.mjs +3 -41
- package/dist/helpers/index.cjs +12 -11
- package/dist/helpers/index.d.cts +7 -4
- package/dist/helpers/index.d.mts +7 -4
- package/dist/helpers/index.mjs +5 -4
- package/dist/helpers/resolve-options.cjs +4 -89
- package/dist/helpers/resolve-options.d.cts +2 -24
- package/dist/helpers/resolve-options.d.mts +2 -25
- package/dist/helpers/resolve-options.mjs +2 -86
- package/dist/helpers/resolve.cjs +3 -62
- package/dist/helpers/resolve.d.cts +2 -27
- package/dist/helpers/resolve.d.mts +2 -28
- package/dist/helpers/resolve.mjs +2 -61
- package/dist/helpers/unplugin.cjs +2 -11
- package/dist/helpers/unplugin.d.cts +4 -8
- package/dist/helpers/unplugin.d.mts +4 -8
- package/dist/helpers/unplugin.mjs +2 -11
- package/dist/helpers-BAUlPOQe.mjs +1 -0
- package/dist/helpers-CAF8Bmv1.cjs +0 -0
- package/dist/index-ClXLQ1fw.d.mts +1 -0
- package/dist/index-DJOHDG5e.d.mts +1 -0
- package/dist/index-DeEmP3Jc.d.cts +1 -0
- package/dist/index-sQecLSpR.d.cts +1 -0
- package/dist/index.cjs +20 -18
- package/dist/index.d.cts +9 -7
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -10
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -5
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-BL8TLixo.mjs +1 -0
- package/dist/plugin-Bivts13R.d.mts +19 -0
- package/dist/plugin-Bivts13R.d.mts.map +1 -0
- package/dist/plugin-OjUZLLkc.cjs +0 -0
- package/dist/plugin-fp0p1CCy.d.cts +19 -0
- package/dist/plugin-fp0p1CCy.d.cts.map +1 -0
- package/dist/resolve-BU3nddJ7.d.mts +27 -0
- package/dist/resolve-BU3nddJ7.d.mts.map +1 -0
- package/dist/resolve-BUiEAXVB.d.cts +27 -0
- package/dist/resolve-BUiEAXVB.d.cts.map +1 -0
- package/dist/resolve-C8OzoP-s.mjs +62 -0
- package/dist/resolve-C8OzoP-s.mjs.map +1 -0
- package/dist/resolve-CsStIaEj.cjs +73 -0
- package/dist/resolve-options-C-213jz6.mjs +87 -0
- package/dist/resolve-options-C-213jz6.mjs.map +1 -0
- package/dist/resolve-options-C3WIGKaG.cjs +137 -0
- package/dist/resolve-options-CpEoapmL.d.mts +23 -0
- package/dist/resolve-options-CpEoapmL.d.mts.map +1 -0
- package/dist/resolve-options-DSHX7AUS.d.cts +23 -0
- package/dist/resolve-options-DSHX7AUS.d.cts.map +1 -0
- package/dist/types/build.cjs +1 -0
- package/dist/types/build.d.cts +2 -8
- package/dist/types/build.d.mts +2 -8
- package/dist/types/build.mjs +2 -0
- package/dist/types/index.cjs +3 -0
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.mts +3 -2
- package/dist/types/index.mjs +4 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +3 -20
- package/dist/types/plugin.d.mts +3 -21
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-CvhspRRt.mjs +1 -0
- package/dist/types-DdloOYgD.cjs +0 -0
- package/dist/unplugin-CW_BVHFj.cjs +16 -0
- package/dist/unplugin-Cf7hyWQE.d.cts +8 -0
- package/dist/unplugin-Cf7hyWQE.d.cts.map +1 -0
- package/dist/unplugin-Csi4d8gj.d.mts +8 -0
- package/dist/unplugin-Csi4d8gj.d.mts.map +1 -0
- package/dist/unplugin-_Yvl6iM8.mjs +11 -0
- package/dist/unplugin-_Yvl6iM8.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/core/src/lib/entry.cjs +0 -22
- package/dist/core/src/lib/entry.mjs +0 -22
- package/dist/core/src/lib/entry.mjs.map +0 -1
- package/dist/core/src/lib/logger.cjs +0 -41
- package/dist/core/src/lib/logger.mjs +0 -40
- package/dist/core/src/lib/logger.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/helpers.cjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs +0 -19
- package/dist/core/src/lib/unplugin/helpers.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/index.cjs +0 -3
- package/dist/core/src/lib/unplugin/index.mjs +0 -5
- package/dist/core/src/lib/unplugin/module-resolution.cjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs +0 -66
- package/dist/core/src/lib/unplugin/module-resolution.mjs.map +0 -1
- package/dist/core/src/lib/unplugin/plugin.cjs +0 -104
- package/dist/core/src/lib/unplugin/plugin.mjs +0 -103
- package/dist/core/src/lib/unplugin/plugin.mjs.map +0 -1
- package/dist/core/src/lib/utilities/source-file.cjs +0 -22
- package/dist/core/src/lib/utilities/source-file.mjs +0 -21
- package/dist/core/src/lib/utilities/source-file.mjs.map +0 -1
- package/dist/core/src/plugin-utils/paths.cjs +0 -2
- package/dist/core/src/plugin-utils/paths.mjs +0 -4
- package/dist/core/src/types/api.d.cts +0 -103
- package/dist/core/src/types/api.d.cts.map +0 -1
- package/dist/core/src/types/api.d.mts +0 -103
- package/dist/core/src/types/api.d.mts.map +0 -1
- package/dist/core/src/types/commands.d.cts +0 -9
- package/dist/core/src/types/commands.d.cts.map +0 -1
- package/dist/core/src/types/commands.d.mts +0 -10
- package/dist/core/src/types/commands.d.mts.map +0 -1
- package/dist/core/src/types/config.d.cts +0 -551
- package/dist/core/src/types/config.d.cts.map +0 -1
- package/dist/core/src/types/config.d.mts +0 -551
- package/dist/core/src/types/config.d.mts.map +0 -1
- package/dist/core/src/types/context.d.cts +0 -511
- package/dist/core/src/types/context.d.cts.map +0 -1
- package/dist/core/src/types/context.d.mts +0 -511
- package/dist/core/src/types/context.d.mts.map +0 -1
- package/dist/core/src/types/fs.d.cts +0 -487
- package/dist/core/src/types/fs.d.cts.map +0 -1
- package/dist/core/src/types/fs.d.mts +0 -487
- package/dist/core/src/types/fs.d.mts.map +0 -1
- package/dist/core/src/types/hooks.d.cts +0 -99
- package/dist/core/src/types/hooks.d.cts.map +0 -1
- package/dist/core/src/types/hooks.d.mts +0 -99
- package/dist/core/src/types/hooks.d.mts.map +0 -1
- package/dist/core/src/types/index.d.mts +0 -9
- package/dist/core/src/types/plugin.d.cts +0 -204
- package/dist/core/src/types/plugin.d.cts.map +0 -1
- package/dist/core/src/types/plugin.d.mts +0 -204
- package/dist/core/src/types/plugin.d.mts.map +0 -1
- package/dist/core/src/types/tsconfig.d.cts +0 -70
- package/dist/core/src/types/tsconfig.d.cts.map +0 -1
- package/dist/core/src/types/tsconfig.d.mts +0 -70
- package/dist/core/src/types/tsconfig.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.cjs +0 -21
- package/dist/core/src/types/unplugin.d.cts +0 -24
- package/dist/core/src/types/unplugin.d.cts.map +0 -1
- package/dist/core/src/types/unplugin.d.mts +0 -25
- package/dist/core/src/types/unplugin.d.mts.map +0 -1
- package/dist/core/src/types/unplugin.mjs +0 -22
- package/dist/core/src/types/unplugin.mjs.map +0 -1
- package/dist/helpers/bundle.d.cts.map +0 -1
- package/dist/helpers/bundle.d.mts.map +0 -1
- package/dist/helpers/bundle.mjs.map +0 -1
- package/dist/helpers/resolve-options.d.cts.map +0 -1
- package/dist/helpers/resolve-options.d.mts.map +0 -1
- package/dist/helpers/resolve-options.mjs.map +0 -1
- package/dist/helpers/resolve.d.cts.map +0 -1
- package/dist/helpers/resolve.d.mts.map +0 -1
- package/dist/helpers/resolve.mjs.map +0 -1
- package/dist/helpers/unplugin.d.cts.map +0 -1
- package/dist/helpers/unplugin.d.mts.map +0 -1
- package/dist/helpers/unplugin.mjs.map +0 -1
- package/dist/types/build.d.cts.map +0 -1
- package/dist/types/build.d.mts.map +0 -1
- package/dist/types/plugin.d.cts.map +0 -1
- package/dist/types/plugin.d.mts.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
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 as n, EsbuildOptions as t };
|
|
8
|
+
//# sourceMappingURL=build-Br4iCJ5d.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-Br4iCJ5d.d.cts","names":[],"sources":["../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,cAAA,GAAiB,KAC3B"}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
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 as n, EsbuildOptions as t };
|
|
8
|
+
//# sourceMappingURL=build-CrohITJo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-CrohITJo.d.mts","names":[],"sources":["../src/types/build.ts"],"sourcesContent":[],"mappings":";;;KAoBY,cAAA,GAAiB,KAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PluginContext } from "@powerlines/core/types/context";
|
|
2
|
+
import { BuildOptions, OutputFile } from "esbuild";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/bundle.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bundle a type definition to a module.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context object containing the environment paths.
|
|
10
|
+
* @param file - The file path to bundle.
|
|
11
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
+
* @returns A promise that resolves to the bundled module.
|
|
13
|
+
*/
|
|
14
|
+
declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { bundle as t };
|
|
17
|
+
//# sourceMappingURL=bundle-Bx7Mimeh.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-Bx7Mimeh.d.cts","names":[],"sources":["../src/helpers/bundle.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;;;;;;AAIU,iBAJY,MAAA,CAIZ,OAAA,EAHC,aAGD,EAAA,IAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EADG,OACH,CADW,YACX,CAAA,CAAA,EAAP,OAAO,CAAC,UAAD,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { r as resolveOptions } from "./resolve-options-C-213jz6.mjs";
|
|
2
|
+
import defu from "defu";
|
|
3
|
+
import { build } from "esbuild";
|
|
4
|
+
import { createUnpluginResolver } from "@powerlines/core/lib/unplugin";
|
|
5
|
+
import { createEsbuildPlugin } from "unplugin";
|
|
6
|
+
import { findFileName } from "@stryke/path/file-path-fns";
|
|
7
|
+
|
|
8
|
+
//#region src/helpers/bundle.ts
|
|
9
|
+
/**
|
|
10
|
+
* Bundle a type definition to a module.
|
|
11
|
+
*
|
|
12
|
+
* @param context - The context object containing the environment paths.
|
|
13
|
+
* @param file - The file path to bundle.
|
|
14
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
15
|
+
* @returns A promise that resolves to the bundled module.
|
|
16
|
+
*/
|
|
17
|
+
async function bundle(context, file, overrides = {}) {
|
|
18
|
+
const path = await context.fs.resolve(file);
|
|
19
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
20
|
+
const result = await build(defu({
|
|
21
|
+
...resolveOptions(context),
|
|
22
|
+
entryPoints: [path],
|
|
23
|
+
write: false,
|
|
24
|
+
sourcemap: false,
|
|
25
|
+
splitting: false,
|
|
26
|
+
treeShaking: false,
|
|
27
|
+
bundle: true,
|
|
28
|
+
packages: "bundle",
|
|
29
|
+
platform: "node",
|
|
30
|
+
logLevel: "silent",
|
|
31
|
+
...overrides
|
|
32
|
+
}, { plugins: [createEsbuildPlugin(createUnpluginResolver(context, `${findFileName(file)} Bundler`))({})] }));
|
|
33
|
+
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
34
|
+
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
35
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
36
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { bundle as t };
|
|
41
|
+
//# sourceMappingURL=bundle-D6QqCoyO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-D6QqCoyO.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 { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\nimport { PluginContext } from \"@powerlines/core/types/context\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport defu from \"defu\";\nimport { build, BuildOptions, OutputFile } from \"esbuild\";\nimport { createEsbuildPlugin } from \"unplugin\";\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: Partial<BuildOptions> = {}\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 ...resolveOptions(context),\n entryPoints: [path],\n write: false,\n sourcemap: false,\n splitting: false,\n treeShaking: false,\n bundle: true,\n packages: \"bundle\",\n platform: \"node\",\n logLevel: \"silent\",\n ...overrides\n } as BuildOptions,\n {\n plugins: [\n createEsbuildPlugin(\n createUnpluginResolver(context, `${findFileName(file)} Bundler`)\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":";;;;;;;;;;;;;;;;AAkCA,eAAsB,OACpB,SACA,MACA,YAAmC,EAAE,EAChB;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,GAAG,eAAe,QAAQ;EAC1B,aAAa,CAAC,KAAK;EACnB,OAAO;EACP,WAAW;EACX,WAAW;EACX,aAAa;EACb,QAAQ;EACR,UAAU;EACV,UAAU;EACV,UAAU;EACV,GAAG;EACJ,EACD,EACE,SAAS,CACP,oBACE,uBAAuB,SAAS,GAAG,aAAa,KAAK,CAAC,UAAU,CACjE,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"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const require_resolve_options = require('./resolve-options-C3WIGKaG.cjs');
|
|
2
|
+
let defu = require("defu");
|
|
3
|
+
defu = require_resolve_options.__toESM(defu);
|
|
4
|
+
let esbuild = require("esbuild");
|
|
5
|
+
let __powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
|
|
6
|
+
let unplugin = require("unplugin");
|
|
7
|
+
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
8
|
+
|
|
9
|
+
//#region src/helpers/bundle.ts
|
|
10
|
+
/**
|
|
11
|
+
* Bundle a type definition to a module.
|
|
12
|
+
*
|
|
13
|
+
* @param context - The context object containing the environment paths.
|
|
14
|
+
* @param file - The file path to bundle.
|
|
15
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
16
|
+
* @returns A promise that resolves to the bundled module.
|
|
17
|
+
*/
|
|
18
|
+
async function bundle(context, file, overrides = {}) {
|
|
19
|
+
const path = await context.fs.resolve(file);
|
|
20
|
+
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
21
|
+
const result = await (0, esbuild.build)((0, defu.default)({
|
|
22
|
+
...require_resolve_options.resolveOptions(context),
|
|
23
|
+
entryPoints: [path],
|
|
24
|
+
write: false,
|
|
25
|
+
sourcemap: false,
|
|
26
|
+
splitting: false,
|
|
27
|
+
treeShaking: false,
|
|
28
|
+
bundle: true,
|
|
29
|
+
packages: "bundle",
|
|
30
|
+
platform: "node",
|
|
31
|
+
logLevel: "silent",
|
|
32
|
+
...overrides
|
|
33
|
+
}, { plugins: [(0, unplugin.createEsbuildPlugin)((0, __powerlines_core_lib_unplugin.createUnpluginResolver)(context, `${(0, __stryke_path_file_path_fns.findFileName)(file)} Bundler`))({})] }));
|
|
34
|
+
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
35
|
+
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
36
|
+
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
37
|
+
return result.outputFiles.filter(Boolean)[0];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
Object.defineProperty(exports, 'bundle', {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return bundle;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BuildOptions, OutputFile } from "esbuild";
|
|
2
|
+
import { PluginContext } from "@powerlines/core/types/context";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/bundle.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bundle a type definition to a module.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context object containing the environment paths.
|
|
10
|
+
* @param file - The file path to bundle.
|
|
11
|
+
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
+
* @returns A promise that resolves to the bundled module.
|
|
13
|
+
*/
|
|
14
|
+
declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { bundle as t };
|
|
17
|
+
//# sourceMappingURL=bundle-UTFhPSjU.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-UTFhPSjU.d.mts","names":[],"sources":["../src/helpers/bundle.ts"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;;;;;;AAIU,iBAJY,MAAA,CAIZ,OAAA,EAHC,aAGD,EAAA,IAAA,EAAA,MAAA,EAAA,SAAA,CAAA,EADG,OACH,CADW,YACX,CAAA,CAAA,EAAP,OAAO,CAAC,UAAD,CAAA"}
|
package/dist/helpers/bundle.cjs
CHANGED
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const require_plugin = require('../core/src/lib/unplugin/plugin.cjs');
|
|
4
|
-
require('../core/src/lib/unplugin/index.cjs');
|
|
5
|
-
let defu = require("defu");
|
|
6
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
7
|
-
let esbuild = require("esbuild");
|
|
8
|
-
let unplugin = require("unplugin");
|
|
9
|
-
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
1
|
+
require('../resolve-options-C3WIGKaG.cjs');
|
|
2
|
+
const require_bundle = require('../bundle-DG12gVtZ.cjs');
|
|
10
3
|
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Bundle a type definition to a module.
|
|
14
|
-
*
|
|
15
|
-
* @param context - The context object containing the environment paths.
|
|
16
|
-
* @param file - The file path to bundle.
|
|
17
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
18
|
-
* @returns A promise that resolves to the bundled module.
|
|
19
|
-
*/
|
|
20
|
-
async function bundle(context, file, overrides = {}) {
|
|
21
|
-
const path = await context.fs.resolve(file);
|
|
22
|
-
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
23
|
-
const result = await (0, esbuild.build)((0, defu.default)({
|
|
24
|
-
...require_helpers_resolve_options.resolveOptions(context),
|
|
25
|
-
entryPoints: [path],
|
|
26
|
-
write: false,
|
|
27
|
-
sourcemap: false,
|
|
28
|
-
splitting: false,
|
|
29
|
-
treeShaking: false,
|
|
30
|
-
bundle: true,
|
|
31
|
-
packages: "bundle",
|
|
32
|
-
platform: "node",
|
|
33
|
-
logLevel: "silent",
|
|
34
|
-
...overrides
|
|
35
|
-
}, { plugins: [(0, unplugin.createEsbuildPlugin)(require_plugin.createUnpluginResolver(context, `${(0, __stryke_path_file_path_fns.findFileName)(file)} Bundler`))({})] }));
|
|
36
|
-
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
37
|
-
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
38
|
-
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
39
|
-
return result.outputFiles.filter(Boolean)[0];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
exports.bundle = bundle;
|
|
4
|
+
exports.bundle = require_bundle.bundle;
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/bundle.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Bundle a type definition to a module.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context object containing the environment paths.
|
|
10
|
-
* @param file - The file path to bundle.
|
|
11
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
-
* @returns A promise that resolves to the bundled module.
|
|
13
|
-
*/
|
|
14
|
-
declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { bundle };
|
|
17
|
-
//# sourceMappingURL=bundle.d.cts.map
|
|
1
|
+
import { t as bundle } from "../bundle-Bx7Mimeh.cjs";
|
|
2
|
+
export { bundle };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
//#region src/helpers/bundle.d.ts
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Bundle a type definition to a module.
|
|
8
|
-
*
|
|
9
|
-
* @param context - The context object containing the environment paths.
|
|
10
|
-
* @param file - The file path to bundle.
|
|
11
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
12
|
-
* @returns A promise that resolves to the bundled module.
|
|
13
|
-
*/
|
|
14
|
-
declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { bundle };
|
|
17
|
-
//# sourceMappingURL=bundle.d.mts.map
|
|
1
|
+
import { t as bundle } from "../bundle-UTFhPSjU.mjs";
|
|
2
|
+
export { bundle };
|
package/dist/helpers/bundle.mjs
CHANGED
|
@@ -1,42 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import "../core/src/lib/unplugin/index.mjs";
|
|
4
|
-
import defu from "defu";
|
|
5
|
-
import { build } from "esbuild";
|
|
6
|
-
import { createEsbuildPlugin } from "unplugin";
|
|
7
|
-
import { findFileName } from "@stryke/path/file-path-fns";
|
|
1
|
+
import "../resolve-options-C-213jz6.mjs";
|
|
2
|
+
import { t as bundle } from "../bundle-D6QqCoyO.mjs";
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Bundle a type definition to a module.
|
|
12
|
-
*
|
|
13
|
-
* @param context - The context object containing the environment paths.
|
|
14
|
-
* @param file - The file path to bundle.
|
|
15
|
-
* @param overrides - Optional overrides for the ESBuild configuration.
|
|
16
|
-
* @returns A promise that resolves to the bundled module.
|
|
17
|
-
*/
|
|
18
|
-
async function bundle(context, file, overrides = {}) {
|
|
19
|
-
const path = await context.fs.resolve(file);
|
|
20
|
-
if (!path || !context.fs.existsSync(path)) throw new Error(`Module not found: "${file}". Please check the path and try again.`);
|
|
21
|
-
const result = await build(defu({
|
|
22
|
-
...resolveOptions(context),
|
|
23
|
-
entryPoints: [path],
|
|
24
|
-
write: false,
|
|
25
|
-
sourcemap: false,
|
|
26
|
-
splitting: false,
|
|
27
|
-
treeShaking: false,
|
|
28
|
-
bundle: true,
|
|
29
|
-
packages: "bundle",
|
|
30
|
-
platform: "node",
|
|
31
|
-
logLevel: "silent",
|
|
32
|
-
...overrides
|
|
33
|
-
}, { plugins: [createEsbuildPlugin(createUnpluginResolver(context, `${findFileName(file)} Bundler`))({})] }));
|
|
34
|
-
if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
|
|
35
|
-
if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
|
|
36
|
-
if (!result.outputFiles || result.outputFiles.filter(Boolean).length === 0) throw new Error(`No output files generated for ${file}. Please check the configuration and try again.`);
|
|
37
|
-
return result.outputFiles.filter(Boolean)[0];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
export { bundle };
|
|
42
|
-
//# sourceMappingURL=bundle.mjs.map
|
|
4
|
+
export { bundle };
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
const require_resolve_options = require('../resolve-options-C3WIGKaG.cjs');
|
|
2
|
+
const require_unplugin = require('../unplugin-CW_BVHFj.cjs');
|
|
3
|
+
const require_bundle = require('../bundle-DG12gVtZ.cjs');
|
|
4
|
+
const require_resolve = require('../resolve-CsStIaEj.cjs');
|
|
5
|
+
require('../helpers-CAF8Bmv1.cjs');
|
|
5
6
|
|
|
6
|
-
exports.DEFAULT_ESBUILD_CONFIG =
|
|
7
|
-
exports.bundle =
|
|
8
|
-
exports.createEsbuildPlugin =
|
|
9
|
-
exports.resolve =
|
|
10
|
-
exports.resolveEntry =
|
|
11
|
-
exports.resolveModule =
|
|
12
|
-
exports.resolveOptions =
|
|
7
|
+
exports.DEFAULT_ESBUILD_CONFIG = require_resolve_options.DEFAULT_ESBUILD_CONFIG;
|
|
8
|
+
exports.bundle = require_bundle.bundle;
|
|
9
|
+
exports.createEsbuildPlugin = require_unplugin.createEsbuildPlugin;
|
|
10
|
+
exports.resolve = require_resolve.resolve;
|
|
11
|
+
exports.resolveEntry = require_resolve_options.resolveEntry;
|
|
12
|
+
exports.resolveModule = require_resolve.resolveModule;
|
|
13
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { bundle } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { t as bundle } from "../bundle-Bx7Mimeh.cjs";
|
|
2
|
+
import { n as resolveModule, t as resolve } from "../resolve-BUiEAXVB.cjs";
|
|
3
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-DSHX7AUS.cjs";
|
|
4
|
+
import "../build-Br4iCJ5d.cjs";
|
|
5
|
+
import "../plugin-fp0p1CCy.cjs";
|
|
6
|
+
import { t as createEsbuildPlugin } from "../unplugin-Cf7hyWQE.cjs";
|
|
7
|
+
import "../index-DeEmP3Jc.cjs";
|
|
5
8
|
export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { bundle } from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { t as bundle } from "../bundle-UTFhPSjU.mjs";
|
|
2
|
+
import { n as resolveModule, t as resolve } from "../resolve-BU3nddJ7.mjs";
|
|
3
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-CpEoapmL.mjs";
|
|
4
|
+
import "../build-CrohITJo.mjs";
|
|
5
|
+
import "../plugin-Bivts13R.mjs";
|
|
6
|
+
import { t as createEsbuildPlugin } from "../unplugin-Csi4d8gj.mjs";
|
|
7
|
+
import "../index-ClXLQ1fw.mjs";
|
|
5
8
|
export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createEsbuildPlugin } from "
|
|
3
|
-
import { bundle } from "
|
|
4
|
-
import {
|
|
1
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-C-213jz6.mjs";
|
|
2
|
+
import { t as createEsbuildPlugin } from "../unplugin-_Yvl6iM8.mjs";
|
|
3
|
+
import { t as bundle } from "../bundle-D6QqCoyO.mjs";
|
|
4
|
+
import { n as resolveModule, t as resolve } from "../resolve-C8OzoP-s.mjs";
|
|
5
|
+
import "../helpers-BAUlPOQe.mjs";
|
|
5
6
|
|
|
6
7
|
export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
|
|
@@ -1,90 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_entry = require('../core/src/lib/entry.cjs');
|
|
3
|
-
let defu = require("defu");
|
|
4
|
-
defu = require_rolldown_runtime.__toESM(defu);
|
|
5
|
-
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
7
|
-
let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
|
-
let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
1
|
+
const require_resolve_options = require('../resolve-options-C3WIGKaG.cjs');
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
platform: "neutral",
|
|
14
|
-
format: "esm",
|
|
15
|
-
write: true,
|
|
16
|
-
minify: true,
|
|
17
|
-
sourcemap: false,
|
|
18
|
-
bundle: true,
|
|
19
|
-
treeShaking: true,
|
|
20
|
-
keepNames: true,
|
|
21
|
-
splitting: true,
|
|
22
|
-
logLevel: "silent"
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Resolves the entry options for esbuild.
|
|
26
|
-
*
|
|
27
|
-
* @param context - The build context.
|
|
28
|
-
* @param entryPoints - The entry points to resolve.
|
|
29
|
-
* @returns The resolved entry options.
|
|
30
|
-
*/
|
|
31
|
-
function resolveEntry(context, entryPoints = []) {
|
|
32
|
-
return entryPoints.reduce((ret, entry) => {
|
|
33
|
-
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);
|
|
34
|
-
else ret[entry.output || require_entry.resolveEntryOutput(context, entry)] = entry.file;
|
|
35
|
-
return ret;
|
|
36
|
-
}, {});
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Resolves the esbuild options.
|
|
40
|
-
*
|
|
41
|
-
* @param context - The build context.
|
|
42
|
-
* @returns The resolved esbuild options.
|
|
43
|
-
*/
|
|
44
|
-
function resolveOptions(context) {
|
|
45
|
-
if (context.config.inject && Object.keys(context.config.inject).length > 0) context.fs.writeSync((0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, context.artifactsPath, "inject-shim.js"), Object.entries(context.config.inject).map(([key, value]) => {
|
|
46
|
-
if (value) if (Array.isArray(value)) {
|
|
47
|
-
if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) {
|
|
48
|
-
if (value.length === 1) return `
|
|
49
|
-
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
50
|
-
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
51
|
-
else if (value.length > 1) return `
|
|
52
|
-
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]}";
|
|
53
|
-
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
54
|
-
} else if (value.length === 1) return `
|
|
55
|
-
import ${key} from "${value[0]}";
|
|
56
|
-
export { ${key} };`;
|
|
57
|
-
else if (value.length > 1) return `
|
|
58
|
-
import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
|
|
59
|
-
export { ${key} };`;
|
|
60
|
-
} else if ((0, __stryke_string_format_camel_case.camelCase)(key) !== key) return `
|
|
61
|
-
import ${(0, __stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
|
|
62
|
-
export { ${(0, __stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
|
|
63
|
-
else return `
|
|
64
|
-
import ${key} from "${value}";
|
|
65
|
-
export { ${key} };`;
|
|
66
|
-
return "";
|
|
67
|
-
}).join("\n"));
|
|
68
|
-
return (0, defu.default)({
|
|
69
|
-
alias: context.alias,
|
|
70
|
-
inject: context.config.inject && Object.keys(context.config.inject).length > 0 ? [(0, __stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, context.artifactsPath, "inject-shim.js")] : void 0
|
|
71
|
-
}, context.config?.esbuild ? context.config.esbuild : {}, {
|
|
72
|
-
mainFields: context.config.resolve.mainFields,
|
|
73
|
-
conditions: context.config.resolve.conditions,
|
|
74
|
-
define: context.config.define,
|
|
75
|
-
resolveExtensions: context.config.resolve.extensions,
|
|
76
|
-
packages: context.config.resolve.skipNodeModulesBundle ? "external" : context.config?.esbuild ? (context.config?.esbuild).packages : void 0,
|
|
77
|
-
format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
|
|
78
|
-
platform: context.config.platform,
|
|
79
|
-
outdir: context.config.output.buildPath,
|
|
80
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
81
|
-
minify: context.config.mode !== "development",
|
|
82
|
-
metafile: context.config.mode === "development",
|
|
83
|
-
sourcemap: context.config.mode === "development"
|
|
84
|
-
}, DEFAULT_ESBUILD_CONFIG);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
//#endregion
|
|
88
|
-
exports.DEFAULT_ESBUILD_CONFIG = DEFAULT_ESBUILD_CONFIG;
|
|
89
|
-
exports.resolveEntry = resolveEntry;
|
|
90
|
-
exports.resolveOptions = resolveOptions;
|
|
3
|
+
exports.DEFAULT_ESBUILD_CONFIG = require_resolve_options.DEFAULT_ESBUILD_CONFIG;
|
|
4
|
+
exports.resolveEntry = require_resolve_options.resolveEntry;
|
|
5
|
+
exports.resolveOptions = require_resolve_options.resolveOptions;
|
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { BuildOptions } from "esbuild";
|
|
4
|
-
|
|
5
|
-
//#region src/helpers/resolve-options.d.ts
|
|
6
|
-
declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
|
|
7
|
-
/**
|
|
8
|
-
* Resolves the entry options for esbuild.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The build context.
|
|
11
|
-
* @param entryPoints - The entry points to resolve.
|
|
12
|
-
* @returns The resolved entry options.
|
|
13
|
-
*/
|
|
14
|
-
declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
|
|
15
|
-
/**
|
|
16
|
-
* Resolves the esbuild options.
|
|
17
|
-
*
|
|
18
|
-
* @param context - The build context.
|
|
19
|
-
* @returns The resolved esbuild options.
|
|
20
|
-
*/
|
|
21
|
-
declare function resolveOptions(context: Context): BuildOptions;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|
|
24
|
-
//# sourceMappingURL=resolve-options.d.cts.map
|
|
1
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-DSHX7AUS.cjs";
|
|
2
|
+
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import "../core/src/types/index.mjs";
|
|
4
|
-
import { BuildOptions } from "esbuild";
|
|
5
|
-
|
|
6
|
-
//#region src/helpers/resolve-options.d.ts
|
|
7
|
-
declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
|
|
8
|
-
/**
|
|
9
|
-
* Resolves the entry options for esbuild.
|
|
10
|
-
*
|
|
11
|
-
* @param context - The build context.
|
|
12
|
-
* @param entryPoints - The entry points to resolve.
|
|
13
|
-
* @returns The resolved entry options.
|
|
14
|
-
*/
|
|
15
|
-
declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
|
|
16
|
-
/**
|
|
17
|
-
* Resolves the esbuild options.
|
|
18
|
-
*
|
|
19
|
-
* @param context - The build context.
|
|
20
|
-
* @returns The resolved esbuild options.
|
|
21
|
-
*/
|
|
22
|
-
declare function resolveOptions(context: Context): BuildOptions;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|
|
25
|
-
//# sourceMappingURL=resolve-options.d.mts.map
|
|
1
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-CpEoapmL.mjs";
|
|
2
|
+
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|
|
@@ -1,87 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import defu from "defu";
|
|
3
|
-
import { joinPaths } from "@stryke/path/join-paths";
|
|
4
|
-
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
5
|
-
import { isString } from "@stryke/type-checks/is-string";
|
|
6
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
1
|
+
import { n as resolveEntry, r as resolveOptions, t as DEFAULT_ESBUILD_CONFIG } from "../resolve-options-C-213jz6.mjs";
|
|
7
2
|
|
|
8
|
-
|
|
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.workspaceConfig.workspaceRoot, 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.workspaceConfig.workspaceRoot, 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 : void 0,
|
|
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.buildPath,
|
|
78
|
-
tsconfig: context.tsconfig.tsconfigFilePath,
|
|
79
|
-
minify: context.config.mode !== "development",
|
|
80
|
-
metafile: context.config.mode === "development",
|
|
81
|
-
sourcemap: context.config.mode === "development"
|
|
82
|
-
}, DEFAULT_ESBUILD_CONFIG);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
//#endregion
|
|
86
|
-
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|
|
87
|
-
//# sourceMappingURL=resolve-options.mjs.map
|
|
3
|
+
export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
|