@powerlines/plugin-hey-api 0.1.76 → 0.1.78

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 (56) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  2. package/dist/helpers/create-operation-id.cjs +15 -2
  3. package/dist/helpers/create-operation-id.d.cts +9 -1
  4. package/dist/helpers/create-operation-id.d.mts +9 -1
  5. package/dist/helpers/create-operation-id.mjs +13 -1
  6. package/dist/helpers/index.cjs +2 -3
  7. package/dist/helpers/index.d.cts +1 -2
  8. package/dist/helpers/index.d.mts +1 -2
  9. package/dist/helpers/index.mjs +1 -2
  10. package/dist/index.cjs +8 -69
  11. package/dist/index.d.cts +3 -4
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +3 -37
  14. package/dist/powerlines/src/plugin-utils/paths.cjs +36 -0
  15. package/dist/powerlines/src/plugin-utils/paths.mjs +35 -0
  16. package/dist/powerlines/src/types/build.d.cts +145 -0
  17. package/dist/powerlines/src/types/build.d.mts +145 -0
  18. package/dist/powerlines/src/types/commands.d.cts +8 -0
  19. package/dist/powerlines/src/types/commands.d.mts +8 -0
  20. package/dist/powerlines/src/types/config.d.cts +376 -0
  21. package/dist/powerlines/src/types/config.d.mts +376 -0
  22. package/dist/powerlines/src/types/context.d.cts +403 -0
  23. package/dist/powerlines/src/types/context.d.mts +403 -0
  24. package/dist/powerlines/src/types/fs.d.cts +486 -0
  25. package/dist/powerlines/src/types/fs.d.mts +486 -0
  26. package/dist/powerlines/src/types/plugin.d.cts +231 -0
  27. package/dist/powerlines/src/types/plugin.d.mts +231 -0
  28. package/dist/powerlines/src/types/resolved.d.cts +81 -0
  29. package/dist/powerlines/src/types/resolved.d.mts +81 -0
  30. package/dist/powerlines/src/types/tsconfig.d.cts +69 -0
  31. package/dist/powerlines/src/types/tsconfig.d.mts +69 -0
  32. package/dist/types/index.cjs +0 -2
  33. package/dist/types/index.d.cts +1 -2
  34. package/dist/types/index.d.mts +1 -2
  35. package/dist/types/index.mjs +0 -3
  36. package/dist/types/plugin.cjs +0 -1
  37. package/dist/types/plugin.d.cts +47 -1
  38. package/dist/types/plugin.d.mts +47 -1
  39. package/dist/types/plugin.mjs +0 -2
  40. package/package.json +5 -5
  41. package/dist/create-operation-id-CdT_cWku.mjs +0 -15
  42. package/dist/create-operation-id-Cw-sRmUe.cjs +0 -21
  43. package/dist/create-operation-id-DDMlsM4b.d.cts +0 -10
  44. package/dist/create-operation-id-_82tqUNg.d.mts +0 -10
  45. package/dist/helpers-B15z10jN.mjs +0 -1
  46. package/dist/helpers-LF26RHol.cjs +0 -0
  47. package/dist/index-9iG2qHLe.d.mts +0 -1
  48. package/dist/index-D-CYNcT9.d.mts +0 -1
  49. package/dist/index-D4ELpJXS.d.cts +0 -1
  50. package/dist/index-DLoAMD9J.d.cts +0 -1
  51. package/dist/plugin-CvDSqVdO.d.mts +0 -1792
  52. package/dist/plugin-YQ0jGDB7.d.cts +0 -1792
  53. package/dist/plugin-ifZVa20V.mjs +0 -1
  54. package/dist/plugin-pBKbb5K9.cjs +0 -0
  55. package/dist/types-U3zd8PTP.mjs +0 -1
  56. package/dist/types-o3zWarRp.cjs +0 -0
@@ -0,0 +1,29 @@
1
+ //#region rolldown:runtime
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,3 +1,16 @@
1
- const require_create_operation_id = require('../create-operation-id-Cw-sRmUe.cjs');
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
2
3
 
3
- exports.createOperationId = require_create_operation_id.createOperationId;
4
+ //#region src/helpers/create-operation-id.ts
5
+ /**
6
+ * Create an Operation Id from a summary string
7
+ *
8
+ * @param summary - The summary string from the specification
9
+ * @returns The generated operation ID
10
+ */
11
+ function createOperationId(summary) {
12
+ return (0, __stryke_string_format_camel_case.camelCase)(summary.replace(/\b(?:a|from|to|the|given|of|an)\b/gi, "").replace("Get list", "list"));
13
+ }
14
+
15
+ //#endregion
16
+ exports.createOperationId = createOperationId;
@@ -1,2 +1,10 @@
1
- import { t as createOperationId } from "../create-operation-id-DDMlsM4b.cjs";
1
+ //#region src/helpers/create-operation-id.d.ts
2
+ /**
3
+ * Create an Operation Id from a summary string
4
+ *
5
+ * @param summary - The summary string from the specification
6
+ * @returns The generated operation ID
7
+ */
8
+ declare function createOperationId(summary: string): string;
9
+ //#endregion
2
10
  export { createOperationId };
@@ -1,2 +1,10 @@
1
- import { t as createOperationId } from "../create-operation-id-_82tqUNg.mjs";
1
+ //#region src/helpers/create-operation-id.d.ts
2
+ /**
3
+ * Create an Operation Id from a summary string
4
+ *
5
+ * @param summary - The summary string from the specification
6
+ * @returns The generated operation ID
7
+ */
8
+ declare function createOperationId(summary: string): string;
9
+ //#endregion
2
10
  export { createOperationId };
@@ -1,3 +1,15 @@
1
- import { t as createOperationId } from "../create-operation-id-CdT_cWku.mjs";
1
+ import { camelCase } from "@stryke/string-format/camel-case";
2
2
 
3
+ //#region src/helpers/create-operation-id.ts
4
+ /**
5
+ * Create an Operation Id from a summary string
6
+ *
7
+ * @param summary - The summary string from the specification
8
+ * @returns The generated operation ID
9
+ */
10
+ function createOperationId(summary) {
11
+ return camelCase(summary.replace(/\b(?:a|from|to|the|given|of|an)\b/gi, "").replace("Get list", "list"));
12
+ }
13
+
14
+ //#endregion
3
15
  export { createOperationId };
@@ -1,4 +1,3 @@
1
- const require_create_operation_id = require('../create-operation-id-Cw-sRmUe.cjs');
2
- require('../helpers-LF26RHol.cjs');
1
+ const require_helpers_create_operation_id = require('./create-operation-id.cjs');
3
2
 
4
- exports.createOperationId = require_create_operation_id.createOperationId;
3
+ exports.createOperationId = require_helpers_create_operation_id.createOperationId;
@@ -1,3 +1,2 @@
1
- import { t as createOperationId } from "../create-operation-id-DDMlsM4b.cjs";
2
- import "../index-DLoAMD9J.cjs";
1
+ import { createOperationId } from "./create-operation-id.cjs";
3
2
  export { createOperationId };
@@ -1,3 +1,2 @@
1
- import { t as createOperationId } from "../create-operation-id-_82tqUNg.mjs";
2
- import "../index-D-CYNcT9.mjs";
1
+ import { createOperationId } from "./create-operation-id.mjs";
3
2
  export { createOperationId };
@@ -1,4 +1,3 @@
1
- import { t as createOperationId } from "../create-operation-id-CdT_cWku.mjs";
2
- import "../helpers-B15z10jN.mjs";
1
+ import { createOperationId } from "./create-operation-id.mjs";
3
2
 
4
3
  export { createOperationId };
package/dist/index.cjs CHANGED
@@ -1,75 +1,15 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
- key = keys[i];
13
- if (!__hasOwnProp.call(to, key) && key !== except) {
14
- __defProp(to, key, {
15
- get: ((k) => from[k]).bind(null, key),
16
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
- });
18
- }
19
- }
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
- value: mod,
25
- enumerable: true
26
- }) : target, mod));
27
-
28
- //#endregion
29
- const require_create_operation_id = require('./create-operation-id-Cw-sRmUe.cjs');
30
- require('./helpers-LF26RHol.cjs');
31
- require('./plugin-pBKbb5K9.cjs');
32
- require('./types-o3zWarRp.cjs');
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_paths = require('./powerlines/src/plugin-utils/paths.cjs');
4
+ const require_helpers_create_operation_id = require('./helpers/create-operation-id.cjs');
5
+ require('./helpers/index.cjs');
33
6
  let __hey_api_openapi_ts = require("@hey-api/openapi-ts");
34
7
  let __stryke_path_join_paths = require("@stryke/path/join-paths");
35
8
  let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
36
9
  let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
37
10
  let defu = require("defu");
38
- defu = __toESM(defu);
39
- let __stryke_path_replace = require("@stryke/path/replace");
11
+ defu = require_rolldown_runtime.__toESM(defu);
40
12
 
41
- //#region ../powerlines/src/plugin-utils/paths.ts
42
- /**
43
- * Replaces tokens in the given path string with their corresponding values from the context.
44
- *
45
- * @remarks
46
- * The following tokens are supported:
47
- * - `{workspaceRoot}` - The root directory of the workspace.
48
- * - `{root}` - The root directory of the project (same as `{projectRoot}`).
49
- * - `{projectRoot}` - The root directory of the project (same as `{root}`).
50
- * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
51
- * - `{powerlinesPath}` - The directory where Powerlines is installed.
52
- * - `{cachePath}` - The environment's directory for cached files.
53
- * - `{dataPath}` - The environment's directory for data files.
54
- * - `{logPath}` - The environment's directory for log files.
55
- * - `{tempPath}` - The environment's directory for temporary files.
56
- * - `{configPath}` - The environment's directory for configuration files.
57
- * - `{outputPath}` - The configured output directory for the project.
58
- * - `{buildPath}` - The configured distribution directory for the project.
59
- * - `{artifactsPath}` - The configured directory for build artifacts.
60
- * - `{builtinPath}` - The configured directory for generated built-in plugins.
61
- * - `{entryPath}` - The configured directory for generated entry files.
62
- *
63
- * @param context - The context containing the values for the path tokens.
64
- * @param path - The path string with tokens to replace.
65
- * @returns The path string with tokens replaced by their corresponding values from the context.
66
- */
67
- function replacePathTokens(context, path) {
68
- if (!path) return path;
69
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
70
- }
71
-
72
- //#endregion
73
13
  //#region src/index.ts
74
14
  /**
75
15
  * A Powerlines plugin to integrate Hey API for code generation.
@@ -109,7 +49,7 @@ const plugin = (options = {}) => {
109
49
  },
110
50
  async configResolved() {
111
51
  this.config.heyApi.output ??= {};
112
- this.config.heyApi.output.path = replacePathTokens(this, this.config.heyApi.output.path);
52
+ this.config.heyApi.output.path = require_paths.replacePathTokens(this, this.config.heyApi.output.path);
113
53
  if (!this.config.heyApi.schema) throw new Error("The `schema` option is required by the Hey API plugin.");
114
54
  if ((0, __stryke_type_checks_is_set_string.isSetString)(this.config.heyApi.schema)) {
115
55
  const result = await this.fetch(this.config.heyApi.schema);
@@ -131,7 +71,7 @@ const plugin = (options = {}) => {
131
71
  ]) {
132
72
  const operation = pathItem[method];
133
73
  if (!(0, __stryke_type_checks_is_set_string.isSetString)(operation?.summary)) continue;
134
- operation.operationId = require_create_operation_id.createOperationId(operation.summary);
74
+ operation.operationId = require_helpers_create_operation_id.createOperationId(operation.summary);
135
75
  }
136
76
  }
137
77
  }
@@ -147,7 +87,6 @@ const plugin = (options = {}) => {
147
87
  var src_default = plugin;
148
88
 
149
89
  //#endregion
150
- exports.__toESM = __toESM;
151
- exports.createOperationId = require_create_operation_id.createOperationId;
90
+ exports.createOperationId = require_helpers_create_operation_id.createOperationId;
152
91
  exports.default = src_default;
153
92
  exports.plugin = plugin;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
- import { t as createOperationId } from "./create-operation-id-DDMlsM4b.cjs";
2
- import "./index-DLoAMD9J.cjs";
3
- import { a as HeyAPIPluginUserConfig, c as __ΩHeyAPIPluginOutputOptions, d as Plugin, i as HeyAPIPluginResolvedConfig, l as __ΩHeyAPIPluginResolvedConfig, n as HeyAPIPluginOptions, o as __ΩHeyAPIPluginContext, r as HeyAPIPluginOutputOptions, s as __ΩHeyAPIPluginOptions, t as HeyAPIPluginContext, u as __ΩHeyAPIPluginUserConfig } from "./plugin-YQ0jGDB7.cjs";
4
- import "./index-D4ELpJXS.cjs";
1
+ import { createOperationId } from "./helpers/create-operation-id.cjs";
2
+ import { Plugin } from "./powerlines/src/types/plugin.cjs";
3
+ import { HeyAPIPluginContext, HeyAPIPluginOptions, HeyAPIPluginOutputOptions, HeyAPIPluginResolvedConfig, HeyAPIPluginUserConfig, __ΩHeyAPIPluginContext, __ΩHeyAPIPluginOptions, __ΩHeyAPIPluginOutputOptions, __ΩHeyAPIPluginResolvedConfig, __ΩHeyAPIPluginUserConfig } from "./types/plugin.cjs";
5
4
 
6
5
  //#region src/index.d.ts
7
6
 
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { t as createOperationId } from "./create-operation-id-_82tqUNg.mjs";
2
- import "./index-D-CYNcT9.mjs";
3
- import { a as HeyAPIPluginUserConfig, c as __ΩHeyAPIPluginOutputOptions, d as Plugin, i as HeyAPIPluginResolvedConfig, l as __ΩHeyAPIPluginResolvedConfig, n as HeyAPIPluginOptions, o as __ΩHeyAPIPluginContext, r as HeyAPIPluginOutputOptions, s as __ΩHeyAPIPluginOptions, t as HeyAPIPluginContext, u as __ΩHeyAPIPluginUserConfig } from "./plugin-CvDSqVdO.mjs";
4
- import "./index-9iG2qHLe.mjs";
1
+ import { createOperationId } from "./helpers/create-operation-id.mjs";
2
+ import { Plugin } from "./powerlines/src/types/plugin.mjs";
3
+ import { HeyAPIPluginContext, HeyAPIPluginOptions, HeyAPIPluginOutputOptions, HeyAPIPluginResolvedConfig, HeyAPIPluginUserConfig, __ΩHeyAPIPluginContext, __ΩHeyAPIPluginOptions, __ΩHeyAPIPluginOutputOptions, __ΩHeyAPIPluginResolvedConfig, __ΩHeyAPIPluginUserConfig } from "./types/plugin.mjs";
4
+ import "./types/index.mjs";
5
5
 
6
6
  //#region src/index.d.ts
7
7
 
package/dist/index.mjs CHANGED
@@ -1,46 +1,12 @@
1
- import { t as createOperationId } from "./create-operation-id-CdT_cWku.mjs";
2
- import "./helpers-B15z10jN.mjs";
3
- import "./plugin-ifZVa20V.mjs";
4
- import "./types-U3zd8PTP.mjs";
1
+ import { replacePathTokens } from "./powerlines/src/plugin-utils/paths.mjs";
2
+ import { createOperationId } from "./helpers/create-operation-id.mjs";
3
+ import "./helpers/index.mjs";
5
4
  import { createClient } from "@hey-api/openapi-ts";
6
5
  import { joinPaths } from "@stryke/path/join-paths";
7
6
  import { isSetObject } from "@stryke/type-checks/is-set-object";
8
7
  import { isSetString } from "@stryke/type-checks/is-set-string";
9
8
  import defu from "defu";
10
- import { replacePath } from "@stryke/path/replace";
11
9
 
12
- //#region ../powerlines/src/plugin-utils/paths.ts
13
- /**
14
- * Replaces tokens in the given path string with their corresponding values from the context.
15
- *
16
- * @remarks
17
- * The following tokens are supported:
18
- * - `{workspaceRoot}` - The root directory of the workspace.
19
- * - `{root}` - The root directory of the project (same as `{projectRoot}`).
20
- * - `{projectRoot}` - The root directory of the project (same as `{root}`).
21
- * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
22
- * - `{powerlinesPath}` - The directory where Powerlines is installed.
23
- * - `{cachePath}` - The environment's directory for cached files.
24
- * - `{dataPath}` - The environment's directory for data files.
25
- * - `{logPath}` - The environment's directory for log files.
26
- * - `{tempPath}` - The environment's directory for temporary files.
27
- * - `{configPath}` - The environment's directory for configuration files.
28
- * - `{outputPath}` - The configured output directory for the project.
29
- * - `{buildPath}` - The configured distribution directory for the project.
30
- * - `{artifactsPath}` - The configured directory for build artifacts.
31
- * - `{builtinPath}` - The configured directory for generated built-in plugins.
32
- * - `{entryPath}` - The configured directory for generated entry files.
33
- *
34
- * @param context - The context containing the values for the path tokens.
35
- * @param path - The path string with tokens to replace.
36
- * @returns The path string with tokens replaced by their corresponding values from the context.
37
- */
38
- function replacePathTokens(context, path) {
39
- if (!path) return path;
40
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
41
- }
42
-
43
- //#endregion
44
10
  //#region src/index.ts
45
11
  /**
46
12
  * A Powerlines plugin to integrate Hey API for code generation.
@@ -0,0 +1,36 @@
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_path_replace = require("@stryke/path/replace");
3
+
4
+ //#region ../powerlines/src/plugin-utils/paths.ts
5
+ /**
6
+ * Replaces tokens in the given path string with their corresponding values from the context.
7
+ *
8
+ * @remarks
9
+ * The following tokens are supported:
10
+ * - `{workspaceRoot}` - The root directory of the workspace.
11
+ * - `{root}` - The root directory of the project (same as `{projectRoot}`).
12
+ * - `{projectRoot}` - The root directory of the project (same as `{root}`).
13
+ * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
14
+ * - `{powerlinesPath}` - The directory where Powerlines is installed.
15
+ * - `{cachePath}` - The environment's directory for cached files.
16
+ * - `{dataPath}` - The environment's directory for data files.
17
+ * - `{logPath}` - The environment's directory for log files.
18
+ * - `{tempPath}` - The environment's directory for temporary files.
19
+ * - `{configPath}` - The environment's directory for configuration files.
20
+ * - `{outputPath}` - The configured output directory for the project.
21
+ * - `{buildPath}` - The configured distribution directory for the project.
22
+ * - `{artifactsPath}` - The configured directory for build artifacts.
23
+ * - `{builtinPath}` - The configured directory for generated built-in plugins.
24
+ * - `{entryPath}` - The configured directory for generated entry files.
25
+ *
26
+ * @param context - The context containing the values for the path tokens.
27
+ * @param path - The path string with tokens to replace.
28
+ * @returns The path string with tokens replaced by their corresponding values from the context.
29
+ */
30
+ function replacePathTokens(context, path) {
31
+ if (!path) return path;
32
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
33
+ }
34
+
35
+ //#endregion
36
+ exports.replacePathTokens = replacePathTokens;
@@ -0,0 +1,35 @@
1
+ import { replacePath } from "@stryke/path/replace";
2
+
3
+ //#region ../powerlines/src/plugin-utils/paths.ts
4
+ /**
5
+ * Replaces tokens in the given path string with their corresponding values from the context.
6
+ *
7
+ * @remarks
8
+ * The following tokens are supported:
9
+ * - `{workspaceRoot}` - The root directory of the workspace.
10
+ * - `{root}` - The root directory of the project (same as `{projectRoot}`).
11
+ * - `{projectRoot}` - The root directory of the project (same as `{root}`).
12
+ * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
13
+ * - `{powerlinesPath}` - The directory where Powerlines is installed.
14
+ * - `{cachePath}` - The environment's directory for cached files.
15
+ * - `{dataPath}` - The environment's directory for data files.
16
+ * - `{logPath}` - The environment's directory for log files.
17
+ * - `{tempPath}` - The environment's directory for temporary files.
18
+ * - `{configPath}` - The environment's directory for configuration files.
19
+ * - `{outputPath}` - The configured output directory for the project.
20
+ * - `{buildPath}` - The configured distribution directory for the project.
21
+ * - `{artifactsPath}` - The configured directory for build artifacts.
22
+ * - `{builtinPath}` - The configured directory for generated built-in plugins.
23
+ * - `{entryPath}` - The configured directory for generated entry files.
24
+ *
25
+ * @param context - The context containing the values for the path tokens.
26
+ * @param path - The path string with tokens to replace.
27
+ * @returns The path string with tokens replaced by their corresponding values from the context.
28
+ */
29
+ function replacePathTokens(context, path) {
30
+ if (!path) return path;
31
+ return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
32
+ }
33
+
34
+ //#endregion
35
+ export { replacePathTokens };
@@ -0,0 +1,145 @@
1
+ //#region ../powerlines/src/types/build.d.ts
2
+
3
+ type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
4
+ interface BuildConfig {
5
+ /**
6
+ * The platform to build the project for
7
+ *
8
+ * @defaultValue "neutral"
9
+ */
10
+ platform?: "node" | "browser" | "neutral";
11
+ /**
12
+ * Array of strings indicating the polyfills to include for the build.
13
+ *
14
+ * @remarks
15
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * {
20
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
21
+ * }
22
+ * ```
23
+ */
24
+ polyfill?: string[];
25
+ /**
26
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
27
+ *
28
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
29
+ */
30
+ mainFields?: string[];
31
+ /**
32
+ * Array of strings indicating what conditions should be used for module resolution.
33
+ */
34
+ conditions?: string[];
35
+ /**
36
+ * Array of strings indicating what file extensions should be used for module resolution.
37
+ *
38
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
39
+ */
40
+ extensions?: string[];
41
+ /**
42
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
43
+ *
44
+ * @remarks
45
+ * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
46
+ */
47
+ dedupe?: string[];
48
+ /**
49
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
50
+ */
51
+ builtins?: (string | RegExp)[];
52
+ /**
53
+ * Define global variable replacements.
54
+ *
55
+ * @remarks
56
+ * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * {
61
+ * define: {
62
+ * __VERSION__: '"1.0.0"',
63
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
64
+ * }
65
+ * }
66
+ * ```
67
+ *
68
+ * @see https://esbuild.github.io/api/#define
69
+ * @see https://vitejs.dev/config/build-options.html#define
70
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
71
+ */
72
+ define?: Record<string, any>;
73
+ /**
74
+ * Global variables that will have import statements injected where necessary
75
+ *
76
+ * @remarks
77
+ * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * {
82
+ * inject: {
83
+ * process: 'process/browser',
84
+ * Buffer: ['buffer', 'Buffer'],
85
+ * }
86
+ * }
87
+ * ```
88
+ *
89
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
90
+ */
91
+ inject?: Record<string, string | string[]>;
92
+ /**
93
+ * The alias mappings to use for module resolution during the build process.
94
+ *
95
+ * @remarks
96
+ * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * {
101
+ * alias: {
102
+ * "@utils": "./src/utils",
103
+ * "@components": "./src/components"
104
+ * }
105
+ * }
106
+ * ```
107
+ *
108
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
109
+ */
110
+ alias?: Record<string, string> | Array<{
111
+ find: string | RegExp;
112
+ replacement: string;
113
+ }>;
114
+ /**
115
+ * A list of modules that should not be bundled, even if they are external dependencies.
116
+ *
117
+ * @remarks
118
+ * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
119
+ */
120
+ external?: (string | RegExp)[];
121
+ /**
122
+ * A list of modules that should always be bundled, even if they are external dependencies.
123
+ */
124
+ noExternal?: (string | RegExp)[];
125
+ /**
126
+ * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
127
+ */
128
+ skipNodeModulesBundle?: boolean;
129
+ /**
130
+ * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
131
+ *
132
+ * @defaultValue false
133
+ */
134
+ keepProcessEnv?: boolean;
135
+ /**
136
+ * An optional set of override options to apply to the selected build variant.
137
+ *
138
+ * @remarks
139
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
140
+ */
141
+ override?: Record<string, any>;
142
+ }
143
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
144
+ //#endregion
145
+ export { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant };