@powerlines/plugin-esbuild 0.13.365 → 0.13.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/package.json +3 -3
  2. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  3. package/dist/helpers/bundle.cjs +0 -46
  4. package/dist/helpers/bundle.d.cts +0 -16
  5. package/dist/helpers/bundle.d.cts.map +0 -1
  6. package/dist/helpers/bundle.d.mts +0 -16
  7. package/dist/helpers/bundle.d.mts.map +0 -1
  8. package/dist/helpers/bundle.mjs +0 -44
  9. package/dist/helpers/bundle.mjs.map +0 -1
  10. package/dist/helpers/index.cjs +0 -13
  11. package/dist/helpers/index.d.cts +0 -5
  12. package/dist/helpers/index.d.mts +0 -5
  13. package/dist/helpers/index.mjs +0 -6
  14. package/dist/helpers/resolve-options.cjs +0 -91
  15. package/dist/helpers/resolve-options.d.cts +0 -23
  16. package/dist/helpers/resolve-options.d.cts.map +0 -1
  17. package/dist/helpers/resolve-options.d.mts +0 -23
  18. package/dist/helpers/resolve-options.d.mts.map +0 -1
  19. package/dist/helpers/resolve-options.mjs +0 -87
  20. package/dist/helpers/resolve-options.mjs.map +0 -1
  21. package/dist/helpers/resolve.cjs +0 -64
  22. package/dist/helpers/resolve.d.cts +0 -26
  23. package/dist/helpers/resolve.d.cts.map +0 -1
  24. package/dist/helpers/resolve.d.mts +0 -26
  25. package/dist/helpers/resolve.d.mts.map +0 -1
  26. package/dist/helpers/resolve.mjs +0 -62
  27. package/dist/helpers/resolve.mjs.map +0 -1
  28. package/dist/helpers/unplugin.cjs +0 -12
  29. package/dist/helpers/unplugin.d.cts +0 -8
  30. package/dist/helpers/unplugin.d.cts.map +0 -1
  31. package/dist/helpers/unplugin.d.mts +0 -8
  32. package/dist/helpers/unplugin.d.mts.map +0 -1
  33. package/dist/helpers/unplugin.mjs +0 -11
  34. package/dist/helpers/unplugin.mjs.map +0 -1
  35. package/dist/index.cjs +0 -47
  36. package/dist/index.d.cts +0 -21
  37. package/dist/index.d.cts.map +0 -1
  38. package/dist/index.d.mts +0 -21
  39. package/dist/index.d.mts.map +0 -1
  40. package/dist/index.mjs +0 -37
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/types/build.cjs +0 -0
  43. package/dist/types/build.d.cts +0 -8
  44. package/dist/types/build.d.cts.map +0 -1
  45. package/dist/types/build.d.mts +0 -8
  46. package/dist/types/build.d.mts.map +0 -1
  47. package/dist/types/build.mjs +0 -1
  48. package/dist/types/index.cjs +0 -0
  49. package/dist/types/index.d.cts +0 -3
  50. package/dist/types/index.d.mts +0 -3
  51. package/dist/types/index.mjs +0 -1
  52. package/dist/types/plugin.cjs +0 -0
  53. package/dist/types/plugin.d.cts +0 -19
  54. package/dist/types/plugin.d.cts.map +0 -1
  55. package/dist/types/plugin.d.mts +0 -19
  56. package/dist/types/plugin.d.mts.map +0 -1
  57. package/dist/types/plugin.mjs +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-esbuild",
3
- "version": "0.13.365",
3
+ "version": "0.13.366",
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,7 +83,7 @@
83
83
  "peerDependencies": { "esbuild": ">=0.27.3" },
84
84
  "peerDependenciesMeta": { "esbuild": { "optional": false } },
85
85
  "dependencies": {
86
- "@powerlines/core": "^0.6.2",
86
+ "@powerlines/core": "^0.7.0",
87
87
  "@stryke/fs": "^0.33.63",
88
88
  "@stryke/path": "^0.27.2",
89
89
  "@stryke/type-checks": "^0.5.41",
@@ -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": "c9c61ea343f037afaa4097720d77cb822eb86e63"
97
+ "gitHead": "c3243c1ec0fbacb4afd4bd3db20432f443334076"
98
98
  }
@@ -1,29 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1,46 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_helpers_resolve_options = require('./resolve-options.cjs');
4
- let defu = require("defu");
5
- defu = require_runtime.__toESM(defu);
6
- let esbuild = require("esbuild");
7
- let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
8
- let unplugin = require("unplugin");
9
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
10
-
11
- //#region src/helpers/bundle.ts
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: true,
30
- bundle: true,
31
- packages: "bundle",
32
- platform: "node",
33
- logLevel: "silent",
34
- ...overrides
35
- }, { plugins: [(0, unplugin.createEsbuildPlugin)((0, _powerlines_core_lib_unplugin.createUnpluginResolver)(context, {
36
- name: `${(0, _stryke_path_file_path_fns.findFileName)(file)} Bundler`,
37
- prefix: false
38
- }))({})] }));
39
- if (result.errors.length > 0) throw new Error(`Failed to bundle ${file}: ${result.errors.map((error) => error.text).join(", ")}`);
40
- if (result.warnings.length > 0) context.warn(`Warnings while bundling ${file}: ${result.warnings.map((warning) => warning.text).join(", ")}`);
41
- 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.`);
42
- return result.outputFiles.filter(Boolean)[0];
43
- }
44
-
45
- //#endregion
46
- exports.bundle = bundle;
@@ -1,16 +0,0 @@
1
- import { PluginContext } from "@powerlines/core";
2
- import { BuildOptions, OutputFile } from "esbuild";
3
-
4
- //#region src/helpers/bundle.d.ts
5
- /**
6
- * Bundle a type definition to a module.
7
- *
8
- * @param context - The context object containing the environment paths.
9
- * @param file - The file path to bundle.
10
- * @param overrides - Optional overrides for the ESBuild configuration.
11
- * @returns A promise that resolves to the bundled module.
12
- */
13
- declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
14
- //#endregion
15
- export { bundle };
16
- //# sourceMappingURL=bundle.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;;AAkCA;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,UACA,SAAA,GAAW,OAAA,CAAQ,YAAA,IAClB,OAAA,CAAQ,UAAA"}
@@ -1,16 +0,0 @@
1
- import { BuildOptions, OutputFile } from "esbuild";
2
- import { PluginContext } from "@powerlines/core";
3
-
4
- //#region src/helpers/bundle.d.ts
5
- /**
6
- * Bundle a type definition to a module.
7
- *
8
- * @param context - The context object containing the environment paths.
9
- * @param file - The file path to bundle.
10
- * @param overrides - Optional overrides for the ESBuild configuration.
11
- * @returns A promise that resolves to the bundled module.
12
- */
13
- declare function bundle(context: PluginContext, file: string, overrides?: Partial<BuildOptions>): Promise<OutputFile>;
14
- //#endregion
15
- export { bundle };
16
- //# sourceMappingURL=bundle.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/helpers/bundle.ts"],"mappings":";;;;;;AAkCA;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,UACA,SAAA,GAAW,OAAA,CAAQ,YAAA,IAClB,OAAA,CAAQ,UAAA"}
@@ -1,44 +0,0 @@
1
- import { resolveOptions } from "./resolve-options.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: true,
27
- bundle: true,
28
- packages: "bundle",
29
- platform: "node",
30
- logLevel: "silent",
31
- ...overrides
32
- }, { plugins: [createEsbuildPlugin(createUnpluginResolver(context, {
33
- name: `${findFileName(file)} Bundler`,
34
- prefix: false
35
- }))({})] }));
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
- export { bundle };
44
- //# sourceMappingURL=bundle.mjs.map
@@ -1 +0,0 @@
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 } from \"@powerlines/core\";\nimport { createUnpluginResolver } from \"@powerlines/core/lib/unplugin\";\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: true,\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, {\n name: `${findFileName(file)} Bundler`,\n prefix: false\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":";;;;;;;;;;;;;;;;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;EAC9B,MAAM,GAAG,aAAa,KAAK,CAAC;EAC5B,QAAQ;EACT,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"}
@@ -1,13 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_helpers_resolve_options = require('./resolve-options.cjs');
3
- const require_helpers_unplugin = require('./unplugin.cjs');
4
- const require_helpers_bundle = require('./bundle.cjs');
5
- const require_helpers_resolve = require('./resolve.cjs');
6
-
7
- exports.DEFAULT_ESBUILD_CONFIG = require_helpers_resolve_options.DEFAULT_ESBUILD_CONFIG;
8
- exports.bundle = require_helpers_bundle.bundle;
9
- exports.createEsbuildPlugin = require_helpers_unplugin.createEsbuildPlugin;
10
- exports.resolve = require_helpers_resolve.resolve;
11
- exports.resolveEntry = require_helpers_resolve_options.resolveEntry;
12
- exports.resolveModule = require_helpers_resolve.resolveModule;
13
- exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
@@ -1,5 +0,0 @@
1
- import { bundle } from "./bundle.cjs";
2
- import { resolve, resolveModule } from "./resolve.cjs";
3
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./resolve-options.cjs";
4
- import { createEsbuildPlugin } from "./unplugin.cjs";
5
- export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
@@ -1,5 +0,0 @@
1
- import { bundle } from "./bundle.mjs";
2
- import { resolve, resolveModule } from "./resolve.mjs";
3
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./resolve-options.mjs";
4
- import { createEsbuildPlugin } from "./unplugin.mjs";
5
- export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
@@ -1,6 +0,0 @@
1
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./resolve-options.mjs";
2
- import { createEsbuildPlugin } from "./unplugin.mjs";
3
- import { bundle } from "./bundle.mjs";
4
- import { resolve, resolveModule } from "./resolve.mjs";
5
-
6
- export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, resolve, resolveEntry, resolveModule, resolveOptions };
@@ -1,91 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let defu = require("defu");
4
- defu = require_runtime.__toESM(defu);
5
- let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
6
- let _stryke_path_join_paths = require("@stryke/path/join-paths");
7
- let _stryke_path_replace = require("@stryke/path/replace");
8
- let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
9
- let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
-
11
- //#region src/helpers/resolve-options.ts
12
- const DEFAULT_ESBUILD_CONFIG = {
13
- target: "esnext",
14
- platform: "neutral",
15
- format: "esm",
16
- write: true,
17
- minify: true,
18
- sourcemap: false,
19
- bundle: true,
20
- treeShaking: true,
21
- keepNames: true,
22
- splitting: true,
23
- logLevel: "silent"
24
- };
25
- /**
26
- * Resolves the entry options for esbuild.
27
- *
28
- * @param context - The build context.
29
- * @param entryPoints - The entry points to resolve.
30
- * @returns The resolved entry options.
31
- */
32
- function resolveEntry(context, entryPoints = []) {
33
- return entryPoints.reduce((ret, entry) => {
34
- if ((0, _stryke_type_checks_is_string.isString)(entry)) ret[(0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)(entry, context.config.root))] = (0, _stryke_path_replace.replacePath)(entry, context.config.root);
35
- else ret[entry.output || (0, _powerlines_core_lib_entry.resolveEntryOutput)(context, entry)] = entry.file;
36
- return ret;
37
- }, {});
38
- }
39
- /**
40
- * Resolves the esbuild options.
41
- *
42
- * @param context - The build context.
43
- * @returns The resolved esbuild options.
44
- */
45
- function resolveOptions(context) {
46
- if (context.config.inject && Object.keys(context.config.inject).length > 0) context.fs.writeSync((0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, context.artifactsPath, "inject-shim.js"), Object.entries(context.config.inject).map(([key, value]) => {
47
- if (value) if (Array.isArray(value)) {
48
- if ((0, _stryke_string_format_camel_case.camelCase)(key) !== key) {
49
- if (value.length === 1) return `
50
- import ${(0, _stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
51
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
52
- else if (value.length > 1) return `
53
- import ${value[1] === "*" ? `* as ${(0, _stryke_string_format_camel_case.camelCase)(key)}` : `{ ${value[1]} as ${(0, _stryke_string_format_camel_case.camelCase)(key)} }`} from "${value[0]}";
54
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
55
- } else if (value.length === 1) return `
56
- import ${key} from "${value[0]}";
57
- export { ${key} };`;
58
- else if (value.length > 1) return `
59
- import ${value[1] === "*" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from "${value[0]}";
60
- export { ${key} };`;
61
- } else if ((0, _stryke_string_format_camel_case.camelCase)(key) !== key) return `
62
- import ${(0, _stryke_string_format_camel_case.camelCase)(key)} from "${value[0]}";
63
- export { ${(0, _stryke_string_format_camel_case.camelCase)(key)} as "${key}" }`;
64
- else return `
65
- import ${key} from "${value}";
66
- export { ${key} };`;
67
- return "";
68
- }).join("\n"));
69
- return (0, defu.default)({
70
- alias: context.alias,
71
- inject: context.config.inject && Object.keys(context.config.inject).length > 0 ? [(0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, context.artifactsPath, "inject-shim.js")] : void 0
72
- }, context.config?.esbuild ? context.config.esbuild : {}, {
73
- mainFields: context.config.resolve.mainFields,
74
- conditions: context.config.resolve.conditions,
75
- define: context.config.define,
76
- resolveExtensions: context.config.resolve.extensions,
77
- packages: context.config.resolve.skipNodeModulesBundle ? "external" : context.config?.esbuild ? (context.config?.esbuild).packages : void 0,
78
- format: Array.isArray(context.config.output.format) ? context.config.output.format[0] : context.config.output.format,
79
- platform: context.config.platform,
80
- outdir: context.config.output.path,
81
- tsconfig: context.tsconfig.tsconfigFilePath,
82
- minify: context.config.mode !== "development",
83
- metafile: context.config.mode === "development",
84
- sourcemap: context.config.mode === "development"
85
- }, DEFAULT_ESBUILD_CONFIG);
86
- }
87
-
88
- //#endregion
89
- exports.DEFAULT_ESBUILD_CONFIG = DEFAULT_ESBUILD_CONFIG;
90
- exports.resolveEntry = resolveEntry;
91
- exports.resolveOptions = resolveOptions;
@@ -1,23 +0,0 @@
1
- import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
2
- import { BuildOptions } from "esbuild";
3
-
4
- //#region src/helpers/resolve-options.d.ts
5
- declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
6
- /**
7
- * Resolves the entry options for esbuild.
8
- *
9
- * @param context - The build context.
10
- * @param entryPoints - The entry points to resolve.
11
- * @returns The resolved entry options.
12
- */
13
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
14
- /**
15
- * Resolves the esbuild options.
16
- *
17
- * @param context - The build context.
18
- * @returns The resolved esbuild options.
19
- */
20
- declare function resolveOptions(context: Context): BuildOptions;
21
- //#endregion
22
- export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
23
- //# sourceMappingURL=resolve-options.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.cts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;cA4Ba,sBAAA,EAAwB,OAAA,CAAQ,YAAA;;AAA7C;;;;;AAqBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;iBAsBa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
@@ -1,23 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
- import { Context, ResolvedEntryTypeDefinition } from "@powerlines/core";
3
-
4
- //#region src/helpers/resolve-options.d.ts
5
- declare const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions>;
6
- /**
7
- * Resolves the entry options for esbuild.
8
- *
9
- * @param context - The build context.
10
- * @param entryPoints - The entry points to resolve.
11
- * @returns The resolved entry options.
12
- */
13
- declare function resolveEntry(context: Context, entryPoints?: ResolvedEntryTypeDefinition[] | string[]): BuildOptions["entryPoints"];
14
- /**
15
- * Resolves the esbuild options.
16
- *
17
- * @param context - The build context.
18
- * @returns The resolved esbuild options.
19
- */
20
- declare function resolveOptions(context: Context): BuildOptions;
21
- //#endregion
22
- export { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions };
23
- //# sourceMappingURL=resolve-options.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.d.mts","names":[],"sources":["../../src/helpers/resolve-options.ts"],"mappings":";;;;cA4Ba,sBAAA,EAAwB,OAAA,CAAQ,YAAA;;AAA7C;;;;;AAqBA;iBAAgB,YAAA,CACd,OAAA,EAAS,OAAA,EACT,WAAA,GAAa,2BAAA,gBACZ,YAAA;;;;;;;iBAsBa,cAAA,CAAe,OAAA,EAAS,OAAA,GAAU,YAAA"}
@@ -1,87 +0,0 @@
1
- import defu from "defu";
2
- import { resolveEntryOutput } from "@powerlines/core/lib/entry";
3
- import { joinPaths } from "@stryke/path/join-paths";
4
- import { replaceExtension, replacePath } from "@stryke/path/replace";
5
- import { camelCase } from "@stryke/string-format/camel-case";
6
- import { isString } from "@stryke/type-checks/is-string";
7
-
8
- //#region src/helpers/resolve-options.ts
9
- const DEFAULT_ESBUILD_CONFIG = {
10
- target: "esnext",
11
- platform: "neutral",
12
- format: "esm",
13
- write: true,
14
- minify: true,
15
- sourcemap: false,
16
- bundle: true,
17
- treeShaking: true,
18
- keepNames: true,
19
- splitting: true,
20
- logLevel: "silent"
21
- };
22
- /**
23
- * Resolves the entry options for esbuild.
24
- *
25
- * @param context - The build context.
26
- * @param entryPoints - The entry points to resolve.
27
- * @returns The resolved entry options.
28
- */
29
- function resolveEntry(context, entryPoints = []) {
30
- return entryPoints.reduce((ret, entry) => {
31
- if (isString(entry)) ret[replaceExtension(replacePath(entry, context.config.root))] = replacePath(entry, context.config.root);
32
- else ret[entry.output || resolveEntryOutput(context, entry)] = entry.file;
33
- return ret;
34
- }, {});
35
- }
36
- /**
37
- * Resolves the esbuild options.
38
- *
39
- * @param context - The build context.
40
- * @returns The resolved esbuild options.
41
- */
42
- function resolveOptions(context) {
43
- if (context.config.inject && Object.keys(context.config.inject).length > 0) context.fs.writeSync(joinPaths(context.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.path,
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-options.mjs","names":[],"sources":["../../src/helpers/resolve-options.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 { Context, ResolvedEntryTypeDefinition } from \"@powerlines/core\";\nimport { resolveEntryOutput } from \"@powerlines/core/lib/entry\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { BuildOptions, Format, LogLevel, Platform } from \"esbuild\";\nimport { EsbuildPluginContext } from \"../types/plugin\";\n\nexport const DEFAULT_ESBUILD_CONFIG: Partial<BuildOptions> = {\n target: \"esnext\",\n platform: \"neutral\" as Platform,\n format: \"esm\" as Format,\n write: true,\n minify: true,\n sourcemap: false,\n bundle: true,\n treeShaking: true,\n keepNames: true,\n splitting: true,\n logLevel: \"silent\" as LogLevel\n};\n\n/**\n * Resolves the entry options for esbuild.\n *\n * @param context - The build context.\n * @param entryPoints - The entry points to resolve.\n * @returns The resolved entry options.\n */\nexport function resolveEntry(\n context: Context,\n entryPoints: ResolvedEntryTypeDefinition[] | string[] = []\n): BuildOptions[\"entryPoints\"] {\n return entryPoints.reduce(\n (ret, entry) => {\n if (isString(entry)) {\n ret[replaceExtension(replacePath(entry, context.config.root))] =\n replacePath(entry, context.config.root);\n } else {\n ret[entry.output || resolveEntryOutput(context, entry)] = entry.file;\n }\n\n return ret;\n },\n {} as Record<string, string>\n );\n}\n\n/**\n * Resolves the esbuild options.\n *\n * @param context - The build context.\n * @returns The resolved esbuild options.\n */\nexport function resolveOptions(context: Context): BuildOptions {\n if (context.config.inject && Object.keys(context.config.inject).length > 0) {\n context.fs.writeSync(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n ),\n Object.entries(context.config.inject)\n .map(([key, value]) => {\n if (value) {\n if (Array.isArray(value)) {\n if (camelCase(key) !== key) {\n if (value.length === 1) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${camelCase(key)}` : `{ ${value[1]} as ${camelCase(key)} }`} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n }\n } else if (value.length === 1) {\n return `\nimport ${key} from \"${value[0]}\";\nexport { ${key} };`;\n } else if (value.length > 1) {\n return `\nimport ${value[1] === \"*\" ? `* as ${key}` : `{ ${value[1]} as ${key} }`} from \"${value[0]}\";\nexport { ${key} };`;\n }\n } else if (camelCase(key) !== key) {\n return `\nimport ${camelCase(key)} from \"${value[0]}\";\nexport { ${camelCase(key)} as \"${key}\" }`;\n } else {\n return `\nimport ${key} from \"${value}\";\nexport { ${key} };`;\n }\n }\n\n return \"\";\n })\n .join(\"\\n\")\n );\n }\n\n return defu(\n {\n alias: context.alias,\n inject:\n context.config.inject && Object.keys(context.config.inject).length > 0\n ? [\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.artifactsPath,\n \"inject-shim.js\"\n )\n ]\n : undefined\n },\n (context as EsbuildPluginContext).config?.esbuild\n ? (context as EsbuildPluginContext).config.esbuild\n : {},\n {\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n define: context.config.define,\n resolveExtensions: context.config.resolve.extensions,\n packages: context.config.resolve.skipNodeModulesBundle\n ? \"external\"\n : (context as EsbuildPluginContext).config?.esbuild\n ? ((context as EsbuildPluginContext).config?.esbuild as BuildOptions)\n .packages\n : undefined,\n format: (Array.isArray(context.config.output.format)\n ? context.config.output.format[0]\n : context.config.output.format) as Format,\n platform: context.config.platform,\n outdir: context.config.output.path,\n tsconfig: context.tsconfig.tsconfigFilePath,\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\"\n },\n DEFAULT_ESBUILD_CONFIG\n ) as BuildOptions;\n}\n"],"mappings":";;;;;;;;AA4BA,MAAa,yBAAgD;CAC3D,QAAQ;CACR,UAAU;CACV,QAAQ;CACR,OAAO;CACP,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,aAAa;CACb,WAAW;CACX,WAAW;CACX,UAAU;CACX;;;;;;;;AASD,SAAgB,aACd,SACA,cAAwD,EAAE,EAC7B;AAC7B,QAAO,YAAY,QAChB,KAAK,UAAU;AACd,MAAI,SAAS,MAAM,CACjB,KAAI,iBAAiB,YAAY,OAAO,QAAQ,OAAO,KAAK,CAAC,IAC3D,YAAY,OAAO,QAAQ,OAAO,KAAK;MAEzC,KAAI,MAAM,UAAU,mBAAmB,SAAS,MAAM,IAAI,MAAM;AAGlE,SAAO;IAET,EAAE,CACH;;;;;;;;AASH,SAAgB,eAAe,SAAgC;AAC7D,KAAI,QAAQ,OAAO,UAAU,OAAO,KAAK,QAAQ,OAAO,OAAO,CAAC,SAAS,EACvE,SAAQ,GAAG,UACT,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,QAAQ,eACR,iBACD,EACD,OAAO,QAAQ,QAAQ,OAAO,OAAO,CAClC,KAAK,CAAC,KAAK,WAAW;AACrB,MAAI,MACF,KAAI,MAAM,QAAQ,MAAM,EACtB;OAAI,UAAU,IAAI,KAAK,KACrB;QAAI,MAAM,WAAW,EACnB,QAAO;SAChB,UAAU,IAAI,CAAC,SAAS,MAAM,GAAG;WAC/B,UAAU,IAAI,CAAC,OAAO,IAAI;aACV,MAAM,SAAS,EACxB,QAAO;SAChB,MAAM,OAAO,MAAM,QAAQ,UAAU,IAAI,KAAK,KAAK,MAAM,GAAG,MAAM,UAAU,IAAI,CAAC,IAAI,SAAS,MAAM,GAAG;WACrG,UAAU,IAAI,CAAC,OAAO,IAAI;cAEZ,MAAM,WAAW,EAC1B,QAAO;SACd,IAAI,SAAS,MAAM,GAAG;WACpB,IAAI;YACU,MAAM,SAAS,EACxB,QAAO;SACd,MAAM,OAAO,MAAM,QAAQ,QAAQ,KAAK,MAAM,GAAG,MAAM,IAAI,IAAI,SAAS,MAAM,GAAG;WAC/E,IAAI;aAEQ,UAAU,IAAI,KAAK,IAC5B,QAAO;SACZ,UAAU,IAAI,CAAC,SAAS,MAAM,GAAG;WAC/B,UAAU,IAAI,CAAC,OAAO,IAAI;MAEvB,QAAO;SACZ,IAAI,SAAS,MAAM;WACjB,IAAI;AAIL,SAAO;GACP,CACD,KAAK,KAAK,CACd;AAGH,QAAO,KACL;EACE,OAAO,QAAQ;EACf,QACE,QAAQ,OAAO,UAAU,OAAO,KAAK,QAAQ,OAAO,OAAO,CAAC,SAAS,IACjE,CACE,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,QAAQ,eACR,iBACD,CACF,GACD;EACP,EACA,QAAiC,QAAQ,UACrC,QAAiC,OAAO,UACzC,EAAE,EACN;EACE,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACnC,QAAQ,QAAQ,OAAO;EACvB,mBAAmB,QAAQ,OAAO,QAAQ;EAC1C,UAAU,QAAQ,OAAO,QAAQ,wBAC7B,aACC,QAAiC,QAAQ,WACtC,QAAiC,QAAQ,SACxC,WACH;EACN,QAAS,MAAM,QAAQ,QAAQ,OAAO,OAAO,OAAO,GAChD,QAAQ,OAAO,OAAO,OAAO,KAC7B,QAAQ,OAAO,OAAO;EAC1B,UAAU,QAAQ,OAAO;EACzB,QAAQ,QAAQ,OAAO,OAAO;EAC9B,UAAU,QAAQ,SAAS;EAC3B,QAAQ,QAAQ,OAAO,SAAS;EAChC,UAAU,QAAQ,OAAO,SAAS;EAClC,WAAW,QAAQ,OAAO,SAAS;EACpC,EACD,uBACD"}
@@ -1,64 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _powerlines_plugin_esbuild_helpers_bundle = require("@powerlines/plugin-esbuild/helpers/bundle");
4
- let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
5
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
6
-
7
- //#region src/helpers/resolve.ts
8
- /**
9
- * Compiles a type definition to a module and returns the module.
10
- *
11
- * @param context - The context object containing the environment paths.
12
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
13
- * @param overrides - Optional overrides for the ESBuild configuration.
14
- * @returns A promise that resolves to the compiled module.
15
- */
16
- async function resolveModule(context, type, overrides = {}) {
17
- let typeDefinition;
18
- if ((0, _stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(type);
19
- else typeDefinition = type;
20
- const result = await (0, _powerlines_plugin_esbuild_helpers_bundle.bundle)(context, typeDefinition.file, overrides);
21
- let resolved;
22
- try {
23
- resolved = await context.resolver.evalModule(result.text, {
24
- filename: result.path,
25
- forceTranspile: true
26
- });
27
- } catch (error) {
28
- if ((0, _stryke_type_checks_is_set_string.isSetString)(error.message) && new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`).test(error.message)) {
29
- const moduleName = error.message.match(new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
30
- throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
31
-
32
- Bundle output for module:
33
- ${result.text}` : ""}`);
34
- }
35
- throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
36
-
37
- Bundle output for module:
38
- ${result.text}` : ""}`);
39
- }
40
- return resolved;
41
- }
42
- /**
43
- * Compiles a type definition to a module and returns the specified export from the module.
44
- *
45
- * @param context - The context object containing the environment paths.
46
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
47
- * @param overrides - Optional overrides for the ESBuild configuration.
48
- * @returns A promise that resolves to the compiled module.
49
- */
50
- async function resolve(context, type, overrides = {}) {
51
- let typeDefinition;
52
- if ((0, _stryke_type_checks_is_set_string.isSetString)(type)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(type);
53
- else typeDefinition = type;
54
- const resolved = await resolveModule(context, typeDefinition, overrides);
55
- let exportName = typeDefinition.name;
56
- if (!exportName) exportName = "default";
57
- const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
58
- if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}`);
59
- return resolvedExport;
60
- }
61
-
62
- //#endregion
63
- exports.resolve = resolve;
64
- exports.resolveModule = resolveModule;
@@ -1,26 +0,0 @@
1
- import { PluginContext } from "@powerlines/core";
2
- import { BuildOptions } from "esbuild";
3
- import { TypeDefinitionParameter } from "@stryke/types/configuration";
4
-
5
- //#region src/helpers/resolve.d.ts
6
- /**
7
- * Compiles a type definition to a module and returns the module.
8
- *
9
- * @param context - The context object containing the environment paths.
10
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
- * @param overrides - Optional overrides for the ESBuild configuration.
12
- * @returns A promise that resolves to the compiled module.
13
- */
14
- declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
15
- /**
16
- * Compiles a type definition to a module and returns the specified export from the module.
17
- *
18
- * @param context - The context object containing the environment paths.
19
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
20
- * @param overrides - Optional overrides for the ESBuild configuration.
21
- * @returns A promise that resolves to the compiled module.
22
- */
23
- declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
24
- //#endregion
25
- export { resolve, resolveModule };
26
- //# sourceMappingURL=resolve.d.cts.map
@@ -1 +0,0 @@
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,OAAA,CAAQ,YAAA,IAClB,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,26 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
- import { PluginContext } from "@powerlines/core";
3
- import { TypeDefinitionParameter } from "@stryke/types/configuration";
4
-
5
- //#region src/helpers/resolve.d.ts
6
- /**
7
- * Compiles a type definition to a module and returns the module.
8
- *
9
- * @param context - The context object containing the environment paths.
10
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
- * @param overrides - Optional overrides for the ESBuild configuration.
12
- * @returns A promise that resolves to the compiled module.
13
- */
14
- declare function resolveModule<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
15
- /**
16
- * Compiles a type definition to a module and returns the specified export from the module.
17
- *
18
- * @param context - The context object containing the environment paths.
19
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
20
- * @param overrides - Optional overrides for the ESBuild configuration.
21
- * @returns A promise that resolves to the compiled module.
22
- */
23
- declare function resolve<TResult>(context: PluginContext, type: TypeDefinitionParameter, overrides?: Partial<BuildOptions>): Promise<TResult>;
24
- //#endregion
25
- export { resolve, resolveModule };
26
- //# sourceMappingURL=resolve.d.mts.map
@@ -1 +0,0 @@
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,OAAA,CAAQ,YAAA,IAClB,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,62 +0,0 @@
1
- import { bundle } from "@powerlines/plugin-esbuild/helpers/bundle";
2
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
3
- import { isSetString } from "@stryke/type-checks/is-set-string";
4
-
5
- //#region src/helpers/resolve.ts
6
- /**
7
- * Compiles a type definition to a module and returns the module.
8
- *
9
- * @param context - The context object containing the environment paths.
10
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
11
- * @param overrides - Optional overrides for the ESBuild configuration.
12
- * @returns A promise that resolves to the compiled module.
13
- */
14
- async function resolveModule(context, type, overrides = {}) {
15
- let typeDefinition;
16
- if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
17
- else typeDefinition = type;
18
- const result = await bundle(context, typeDefinition.file, overrides);
19
- let resolved;
20
- try {
21
- resolved = await context.resolver.evalModule(result.text, {
22
- filename: result.path,
23
- forceTranspile: true
24
- });
25
- } catch (error) {
26
- if (isSetString(error.message) && new RegExp(`Cannot find module '${context.config.framework || "powerlines"}:.*'`).test(error.message)) {
27
- const moduleName = error.message.match(new RegExp(`Cannot find module '(${context.config.framework || "powerlines"}:.*)'`))?.[1];
28
- throw new Error(`The module "${moduleName}" could not be resolved while evaluating "${typeDefinition.file}". It is possible the required built-in modules have not yet been generated. Please check the order of your plugins. ${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
29
-
30
- Bundle output for module:
31
- ${result.text}` : ""}`);
32
- }
33
- throw new Error(`Failed to evaluate the bundled module for "${typeDefinition.file}". Error: ${error.message}${context.config.logLevel === "debug" || context.config.logLevel === "trace" ? `
34
-
35
- Bundle output for module:
36
- ${result.text}` : ""}`);
37
- }
38
- return resolved;
39
- }
40
- /**
41
- * Compiles a type definition to a module and returns the specified export from the module.
42
- *
43
- * @param context - The context object containing the environment paths.
44
- * @param type - The type definition to compile. This can be either a string or a {@link TypeDefinition} object.
45
- * @param overrides - Optional overrides for the ESBuild configuration.
46
- * @returns A promise that resolves to the compiled module.
47
- */
48
- async function resolve(context, type, overrides = {}) {
49
- let typeDefinition;
50
- if (isSetString(type)) typeDefinition = parseTypeDefinition(type);
51
- else typeDefinition = type;
52
- const resolved = await resolveModule(context, typeDefinition, overrides);
53
- let exportName = typeDefinition.name;
54
- if (!exportName) exportName = "default";
55
- const resolvedExport = resolved[exportName] ?? resolved[`__Ω${exportName}`];
56
- if (resolvedExport === void 0) throw new Error(`The export "${exportName}" could not be resolved in the "${typeDefinition.file}" module. ${Object.keys(resolved).length === 0 ? `After bundling, no exports were found in the module. Please ensure that the "${typeDefinition.file}" module has a "${exportName}" export with the desired value.` : `After bundling, the available exports were: ${Object.keys(resolved).join(", ")}. Please ensure that the export exists and is correctly named.`}`);
57
- return resolvedExport;
58
- }
59
-
60
- //#endregion
61
- export { resolve, resolveModule };
62
- //# sourceMappingURL=resolve.mjs.map
@@ -1 +0,0 @@
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 { bundle } from \"@powerlines/plugin-esbuild/helpers/bundle\";\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\";\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: 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 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,YAAmC,EAAE,EACnB;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,12 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- let _powerlines_core_lib_unplugin = require("@powerlines/core/lib/unplugin");
4
- let unplugin = require("unplugin");
5
-
6
- //#region src/helpers/unplugin.ts
7
- function createEsbuildPlugin(context) {
8
- return (0, unplugin.createEsbuildPlugin)((0, _powerlines_core_lib_unplugin.createUnplugin)(context))({});
9
- }
10
-
11
- //#endregion
12
- exports.createEsbuildPlugin = createEsbuildPlugin;
@@ -1,8 +0,0 @@
1
- import { EsbuildPluginContext } from "../types/plugin.cjs";
2
- import * as esbuild from "esbuild";
3
-
4
- //#region src/helpers/unplugin.d.ts
5
- declare function createEsbuildPlugin(context: EsbuildPluginContext): esbuild.Plugin;
6
- //#endregion
7
- export { createEsbuildPlugin };
8
- //# sourceMappingURL=unplugin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unplugin.d.cts","names":[],"sources":["../../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,mBAAA,CAAoB,OAAA,EAAS,oBAAA,GAAoB,OAAA,CAAA,MAAA"}
@@ -1,8 +0,0 @@
1
- import { EsbuildPluginContext } from "../types/plugin.mjs";
2
- import * as esbuild from "esbuild";
3
-
4
- //#region src/helpers/unplugin.d.ts
5
- declare function createEsbuildPlugin(context: EsbuildPluginContext): esbuild.Plugin;
6
- //#endregion
7
- export { createEsbuildPlugin };
8
- //# sourceMappingURL=unplugin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unplugin.d.mts","names":[],"sources":["../../src/helpers/unplugin.ts"],"mappings":";;;;iBAsBgB,mBAAA,CAAoB,OAAA,EAAS,oBAAA,GAAoB,OAAA,CAAA,MAAA"}
@@ -1,11 +0,0 @@
1
- import { createUnplugin } from "@powerlines/core/lib/unplugin";
2
- import { createEsbuildPlugin as createEsbuildPlugin$1 } from "unplugin";
3
-
4
- //#region src/helpers/unplugin.ts
5
- function createEsbuildPlugin(context) {
6
- return createEsbuildPlugin$1(createUnplugin(context))({});
7
- }
8
-
9
- //#endregion
10
- export { createEsbuildPlugin };
11
- //# sourceMappingURL=unplugin.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unplugin.mjs","names":["createEsbuildUnplugin"],"sources":["../../src/helpers/unplugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createEsbuildPlugin as createEsbuildUnplugin } from \"unplugin\";\nimport { EsbuildPluginContext } from \"../types/plugin\";\n\nexport function createEsbuildPlugin(context: EsbuildPluginContext) {\n return createEsbuildUnplugin(createUnplugin(context))({});\n}\n"],"mappings":";;;;AAsBA,SAAgB,oBAAoB,SAA+B;AACjE,QAAOA,sBAAsB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC"}
package/dist/index.cjs DELETED
@@ -1,47 +0,0 @@
1
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
4
- const require_helpers_unplugin = require('./helpers/unplugin.cjs');
5
- const require_helpers_bundle = require('./helpers/bundle.cjs');
6
- const require_helpers_resolve = require('./helpers/resolve.cjs');
7
- require('./helpers/index.cjs');
8
- let defu = require("defu");
9
- defu = require_runtime.__toESM(defu);
10
- let esbuild = require("esbuild");
11
-
12
- //#region src/index.ts
13
- /**
14
- * A Powerlines plugin to assist in developing other Powerlines plugins.
15
- */
16
- const plugin = (options = {}) => {
17
- return {
18
- name: "esbuild",
19
- config() {
20
- return {
21
- output: { format: ["esm"] },
22
- build: {
23
- ...require_helpers_resolve_options.DEFAULT_ESBUILD_CONFIG,
24
- ...options,
25
- variant: "esbuild"
26
- }
27
- };
28
- },
29
- async build() {
30
- await (0, esbuild.build)((0, defu.default)({
31
- entryPoints: require_helpers_resolve_options.resolveEntry(this, this.entry),
32
- plugins: [require_helpers_unplugin.createEsbuildPlugin(this)]
33
- }, require_helpers_resolve_options.resolveOptions(this)));
34
- }
35
- };
36
- };
37
-
38
- //#endregion
39
- exports.DEFAULT_ESBUILD_CONFIG = require_helpers_resolve_options.DEFAULT_ESBUILD_CONFIG;
40
- exports.bundle = require_helpers_bundle.bundle;
41
- exports.createEsbuildPlugin = require_helpers_unplugin.createEsbuildPlugin;
42
- exports.default = plugin;
43
- exports.plugin = plugin;
44
- exports.resolve = require_helpers_resolve.resolve;
45
- exports.resolveEntry = require_helpers_resolve_options.resolveEntry;
46
- exports.resolveModule = require_helpers_resolve.resolveModule;
47
- exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
package/dist/index.d.cts DELETED
@@ -1,21 +0,0 @@
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
- import { EsbuildOptions, __ΩEsbuildOptions } from "./types/build.cjs";
5
- import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./types/plugin.cjs";
6
- import { createEsbuildPlugin } from "./helpers/unplugin.cjs";
7
- import { Plugin } from "@powerlines/core";
8
-
9
- //#region src/index.d.ts
10
- declare module "@powerlines/core" {
11
- interface Config {
12
- esbuild?: EsbuildPluginOptions;
13
- }
14
- }
15
- /**
16
- * A Powerlines plugin to assist in developing other Powerlines plugins.
17
- */
18
- declare const plugin: <TContext extends EsbuildPluginContext = EsbuildPluginContext>(options?: EsbuildPluginOptions) => Plugin<TContext>;
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 };
21
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;YAqCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;AAJU;cAWX,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.d.mts DELETED
@@ -1,21 +0,0 @@
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
- import { EsbuildOptions, __ΩEsbuildOptions } from "./types/build.mjs";
5
- import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./types/plugin.mjs";
6
- import { createEsbuildPlugin } from "./helpers/unplugin.mjs";
7
- import { Plugin } from "@powerlines/core";
8
-
9
- //#region src/index.d.ts
10
- declare module "@powerlines/core" {
11
- interface Config {
12
- esbuild?: EsbuildPluginOptions;
13
- }
14
- }
15
- /**
16
- * A Powerlines plugin to assist in developing other Powerlines plugins.
17
- */
18
- declare const plugin: <TContext extends EsbuildPluginContext = EsbuildPluginContext>(options?: EsbuildPluginOptions) => Plugin<TContext>;
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 };
21
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;YAqCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;AAJU;cAWX,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs DELETED
@@ -1,37 +0,0 @@
1
- import { DEFAULT_ESBUILD_CONFIG, resolveEntry, resolveOptions } from "./helpers/resolve-options.mjs";
2
- import { createEsbuildPlugin } from "./helpers/unplugin.mjs";
3
- import { bundle } from "./helpers/bundle.mjs";
4
- import { resolve, resolveModule } from "./helpers/resolve.mjs";
5
- import "./helpers/index.mjs";
6
- import defu from "defu";
7
- import { build } from "esbuild";
8
-
9
- //#region src/index.ts
10
- /**
11
- * A Powerlines plugin to assist in developing other Powerlines plugins.
12
- */
13
- const plugin = (options = {}) => {
14
- return {
15
- name: "esbuild",
16
- config() {
17
- return {
18
- output: { format: ["esm"] },
19
- build: {
20
- ...DEFAULT_ESBUILD_CONFIG,
21
- ...options,
22
- variant: "esbuild"
23
- }
24
- };
25
- },
26
- async build() {
27
- await build(defu({
28
- entryPoints: resolveEntry(this, this.entry),
29
- plugins: [createEsbuildPlugin(this)]
30
- }, resolveOptions(this)));
31
- }
32
- };
33
- };
34
-
35
- //#endregion
36
- export { DEFAULT_ESBUILD_CONFIG, bundle, createEsbuildPlugin, plugin as default, plugin, resolve, resolveEntry, resolveModule, resolveOptions };
37
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build } from \"esbuild\";\nimport {\n DEFAULT_ESBUILD_CONFIG,\n resolveEntry,\n resolveOptions\n} from \"./helpers/resolve-options\";\nimport { createEsbuildPlugin } from \"./helpers/unplugin\";\nimport {\n EsbuildPluginContext,\n EsbuildPluginOptions,\n EsbuildPluginUserConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface Config {\n esbuild?: EsbuildPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends EsbuildPluginContext = EsbuildPluginContext\n>(\n options: EsbuildPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"esbuild\",\n config() {\n return {\n output: {\n format: [\"esm\"]\n },\n build: {\n ...DEFAULT_ESBUILD_CONFIG,\n ...options,\n variant: \"esbuild\"\n }\n } as Partial<EsbuildPluginUserConfig>;\n },\n async build() {\n await build(\n defu(\n {\n entryPoints: resolveEntry(this, this.entry),\n plugins: [createEsbuildPlugin(this)]\n },\n resolveOptions(this)\n )\n );\n }\n };\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;AA6CA,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,UAAO;IACL,QAAQ,EACN,QAAQ,CAAC,MAAM,EAChB;IACD,OAAO;KACL,GAAG;KACH,GAAG;KACH,SAAS;KACV;IACF;;EAEH,MAAM,QAAQ;AACZ,SAAM,MACJ,KACE;IACE,aAAa,aAAa,MAAM,KAAK,MAAM;IAC3C,SAAS,CAAC,oBAAoB,KAAK,CAAC;IACrC,EACD,eAAe,KAAK,CACrB,CACF;;EAEJ"}
File without changes
@@ -1,8 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
-
3
- //#region src/types/build.d.ts
4
- type EsbuildOptions = Omit<BuildOptions, "entryPoints" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel">;
5
- declare type __ΩEsbuildOptions = any[];
6
- //#endregion
7
- export { EsbuildOptions, __ΩEsbuildOptions };
8
- //# sourceMappingURL=build.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.cts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,IAAA,CAC3B,YAAA;AAAA"}
@@ -1,8 +0,0 @@
1
- import { BuildOptions } from "esbuild";
2
-
3
- //#region src/types/build.d.ts
4
- type EsbuildOptions = Omit<BuildOptions, "entryPoints" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel">;
5
- declare type __ΩEsbuildOptions = any[];
6
- //#endregion
7
- export { EsbuildOptions, __ΩEsbuildOptions };
8
- //# sourceMappingURL=build.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build.d.mts","names":[],"sources":["../../src/types/build.ts"],"mappings":";;;KAoBY,cAAA,GAAiB,IAAA,CAC3B,YAAA;AAAA"}
@@ -1 +0,0 @@
1
- export { };
File without changes
@@ -1,3 +0,0 @@
1
- import { EsbuildOptions, __ΩEsbuildOptions } from "./build.cjs";
2
- import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./plugin.cjs";
3
- export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
@@ -1,3 +0,0 @@
1
- import { EsbuildOptions, __ΩEsbuildOptions } from "./build.mjs";
2
- import { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig } from "./plugin.mjs";
3
- export { EsbuildOptions, EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildOptions, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
@@ -1 +0,0 @@
1
- export { };
File without changes
@@ -1,19 +0,0 @@
1
- import { EsbuildOptions } from "./build.cjs";
2
- import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
-
4
- //#region src/types/plugin.d.ts
5
- type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
- interface EsbuildPluginUserConfig extends UserConfig {
7
- esbuild?: EsbuildPluginOptions;
8
- }
9
- interface EsbuildPluginResolvedConfig extends ResolvedConfig {
10
- esbuild: EsbuildOptions;
11
- }
12
- type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
- declare type __ΩEsbuildPluginOptions = any[];
14
- declare type __ΩEsbuildPluginUserConfig = any[];
15
- declare type __ΩEsbuildPluginResolvedConfig = any[];
16
- declare type __ΩEsbuildPluginContext = any[];
17
- //#endregion
18
- export { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
19
- //# sourceMappingURL=plugin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KAqBY,oBAAA,GAAuB,OAAA,CAAQ,cAAA;AAAA,UAE1B,uBAAA,SAAgC,UAAA;EAC/C,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,2BAAA,SAAoC,cAAA;EACnD,OAAA,EAAS,cAAA;AAAA;AAAA,KAGC,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
@@ -1,19 +0,0 @@
1
- import { EsbuildOptions } from "./build.mjs";
2
- import { PluginContext, ResolvedConfig, UserConfig } from "@powerlines/core";
3
-
4
- //#region src/types/plugin.d.ts
5
- type EsbuildPluginOptions = Partial<EsbuildOptions>;
6
- interface EsbuildPluginUserConfig extends UserConfig {
7
- esbuild?: EsbuildPluginOptions;
8
- }
9
- interface EsbuildPluginResolvedConfig extends ResolvedConfig {
10
- esbuild: EsbuildOptions;
11
- }
12
- type EsbuildPluginContext<TResolvedConfig extends EsbuildPluginResolvedConfig = EsbuildPluginResolvedConfig> = PluginContext<TResolvedConfig>;
13
- declare type __ΩEsbuildPluginOptions = any[];
14
- declare type __ΩEsbuildPluginUserConfig = any[];
15
- declare type __ΩEsbuildPluginResolvedConfig = any[];
16
- declare type __ΩEsbuildPluginContext = any[];
17
- //#endregion
18
- export { EsbuildPluginContext, EsbuildPluginOptions, EsbuildPluginResolvedConfig, EsbuildPluginUserConfig, __ΩEsbuildPluginContext, __ΩEsbuildPluginOptions, __ΩEsbuildPluginResolvedConfig, __ΩEsbuildPluginUserConfig };
19
- //# sourceMappingURL=plugin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;KAqBY,oBAAA,GAAuB,OAAA,CAAQ,cAAA;AAAA,UAE1B,uBAAA,SAAgC,UAAA;EAC/C,OAAA,GAAU,oBAAA;AAAA;AAAA,UAGK,2BAAA,SAAoC,cAAA;EACnD,OAAA,EAAS,cAAA;AAAA;AAAA,KAGC,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA;AAAA"}
@@ -1 +0,0 @@
1
- export { };