@powerlines/engine 0.0.25 → 0.9.1

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 (191) hide show
  1. package/dist/api/build.cjs +66 -0
  2. package/dist/api/build.d.cts +14 -0
  3. package/dist/api/build.d.cts.map +1 -0
  4. package/dist/api/build.d.mts +14 -0
  5. package/dist/api/build.d.mts.map +1 -0
  6. package/dist/api/build.mjs +64 -0
  7. package/dist/api/build.mjs.map +1 -0
  8. package/dist/api/clean.cjs +29 -0
  9. package/dist/api/clean.d.cts +14 -0
  10. package/dist/api/clean.d.cts.map +1 -0
  11. package/dist/api/clean.d.mts +14 -0
  12. package/dist/api/clean.d.mts.map +1 -0
  13. package/dist/api/clean.mjs +28 -0
  14. package/dist/api/clean.mjs.map +1 -0
  15. package/dist/api/create.cjs +59 -0
  16. package/dist/api/create.d.cts +14 -0
  17. package/dist/api/create.d.cts.map +1 -0
  18. package/dist/api/create.d.mts +14 -0
  19. package/dist/api/create.d.mts.map +1 -0
  20. package/dist/api/create.mjs +57 -0
  21. package/dist/api/create.mjs.map +1 -0
  22. package/dist/api/deploy.cjs +25 -0
  23. package/dist/api/deploy.d.cts +17 -0
  24. package/dist/api/deploy.d.cts.map +1 -0
  25. package/dist/api/deploy.d.mts +17 -0
  26. package/dist/api/deploy.d.mts.map +1 -0
  27. package/dist/api/deploy.mjs +24 -0
  28. package/dist/api/deploy.mjs.map +1 -0
  29. package/dist/api/docs.cjs +25 -0
  30. package/dist/api/docs.d.cts +17 -0
  31. package/dist/api/docs.d.cts.map +1 -0
  32. package/dist/api/docs.d.mts +17 -0
  33. package/dist/api/docs.d.mts.map +1 -0
  34. package/dist/api/docs.mjs +24 -0
  35. package/dist/api/docs.mjs.map +1 -0
  36. package/dist/api/lint.cjs +28 -0
  37. package/dist/api/lint.d.cts +17 -0
  38. package/dist/api/lint.d.cts.map +1 -0
  39. package/dist/api/lint.d.mts +17 -0
  40. package/dist/api/lint.d.mts.map +1 -0
  41. package/dist/api/lint.mjs +27 -0
  42. package/dist/api/lint.mjs.map +1 -0
  43. package/dist/api/prepare.cjs +69 -0
  44. package/dist/api/prepare.d.cts +14 -0
  45. package/dist/api/prepare.d.cts.map +1 -0
  46. package/dist/api/prepare.d.mts +14 -0
  47. package/dist/api/prepare.d.mts.map +1 -0
  48. package/dist/api/prepare.mjs +68 -0
  49. package/dist/api/prepare.mjs.map +1 -0
  50. package/dist/api/test.cjs +28 -0
  51. package/dist/api/test.d.cts +17 -0
  52. package/dist/api/test.d.cts.map +1 -0
  53. package/dist/api/test.d.mts +17 -0
  54. package/dist/api/test.d.mts.map +1 -0
  55. package/dist/api/test.mjs +27 -0
  56. package/dist/api/test.mjs.map +1 -0
  57. package/dist/api/types.cjs +71 -0
  58. package/dist/api/types.d.cts +17 -0
  59. package/dist/api/types.d.cts.map +1 -0
  60. package/dist/api/types.d.mts +17 -0
  61. package/dist/api/types.d.mts.map +1 -0
  62. package/dist/api/types.mjs +70 -0
  63. package/dist/api/types.mjs.map +1 -0
  64. package/dist/api-Bw-RpQgX.d.cts +134 -0
  65. package/dist/api-Bw-RpQgX.d.cts.map +1 -0
  66. package/dist/api-D9bpSxPB.d.mts +134 -0
  67. package/dist/api-D9bpSxPB.d.mts.map +1 -0
  68. package/dist/config-B_E_HMcT.d.cts +200 -0
  69. package/dist/config-B_E_HMcT.d.cts.map +1 -0
  70. package/dist/config-FB8Zqjjz.d.mts +200 -0
  71. package/dist/config-FB8Zqjjz.d.mts.map +1 -0
  72. package/dist/context/index.cjs +2 -9
  73. package/dist/context/index.d.cts +2 -660
  74. package/dist/context/index.d.mts +2 -660
  75. package/dist/context/index.mjs +2 -4
  76. package/dist/context-C_P-KYJX.d.cts +149 -0
  77. package/dist/context-C_P-KYJX.d.cts.map +1 -0
  78. package/dist/context-DrNGEC0b.d.mts +149 -0
  79. package/dist/context-DrNGEC0b.d.mts.map +1 -0
  80. package/dist/engine-context-BXjBJuHe.d.mts +54 -0
  81. package/dist/engine-context-BXjBJuHe.d.mts.map +1 -0
  82. package/dist/engine-context-CPYw-aGB.d.cts +54 -0
  83. package/dist/engine-context-CPYw-aGB.d.cts.map +1 -0
  84. package/dist/engine-context-SEzTm1aq.cjs +179 -0
  85. package/dist/engine-context-f72fUF0N.mjs +173 -0
  86. package/dist/engine-context-f72fUF0N.mjs.map +1 -0
  87. package/dist/engine.cjs +267 -0
  88. package/dist/engine.d.cts +143 -0
  89. package/dist/engine.d.cts.map +1 -0
  90. package/dist/engine.d.mts +143 -0
  91. package/dist/engine.d.mts.map +1 -0
  92. package/dist/engine.mjs +263 -0
  93. package/dist/engine.mjs.map +1 -0
  94. package/dist/helpers/create-execution-host.cjs +23 -0
  95. package/dist/helpers/create-execution-host.d.cts +18 -0
  96. package/dist/helpers/create-execution-host.d.cts.map +1 -0
  97. package/dist/helpers/create-execution-host.d.mts +18 -0
  98. package/dist/helpers/create-execution-host.d.mts.map +1 -0
  99. package/dist/helpers/create-execution-host.mjs +22 -0
  100. package/dist/helpers/create-execution-host.mjs.map +1 -0
  101. package/dist/helpers/execution-host-worker.cjs +307 -0
  102. package/dist/helpers/execution-host-worker.d.cts +64 -0
  103. package/dist/helpers/execution-host-worker.d.cts.map +1 -0
  104. package/dist/helpers/execution-host-worker.d.mts +64 -0
  105. package/dist/helpers/execution-host-worker.d.mts.map +1 -0
  106. package/dist/helpers/execution-host-worker.mjs +306 -0
  107. package/dist/helpers/execution-host-worker.mjs.map +1 -0
  108. package/dist/helpers/finalize.cjs +27 -0
  109. package/dist/helpers/finalize.d.cts +12 -0
  110. package/dist/helpers/finalize.d.cts.map +1 -0
  111. package/dist/helpers/finalize.d.mts +12 -0
  112. package/dist/helpers/finalize.d.mts.map +1 -0
  113. package/dist/helpers/finalize.mjs +26 -0
  114. package/dist/helpers/finalize.mjs.map +1 -0
  115. package/dist/helpers/rpc.cjs +140 -0
  116. package/dist/helpers/rpc.d.cts +7 -0
  117. package/dist/helpers/rpc.d.cts.map +1 -0
  118. package/dist/helpers/rpc.d.mts +7 -0
  119. package/dist/helpers/rpc.d.mts.map +1 -0
  120. package/dist/helpers/rpc.mjs +139 -0
  121. package/dist/helpers/rpc.mjs.map +1 -0
  122. package/dist/index.cjs +4 -567
  123. package/dist/index.d.cts +5 -126
  124. package/dist/index.d.mts +5 -126
  125. package/dist/index.mjs +2 -567
  126. package/dist/worker/execution-host.cjs +419 -0
  127. package/dist/worker/execution-host.d.cts +26 -0
  128. package/dist/worker/execution-host.d.cts.map +1 -0
  129. package/dist/worker/execution-host.d.mts +26 -0
  130. package/dist/worker/execution-host.d.mts.map +1 -0
  131. package/dist/worker/execution-host.mjs +382 -0
  132. package/dist/worker/execution-host.mjs.map +1 -0
  133. package/package.json +88 -124
  134. package/dist/_internal/worker.cjs +0 -4844
  135. package/dist/_internal/worker.d.cts +0 -38
  136. package/dist/_internal/worker.d.cts.map +0 -1
  137. package/dist/_internal/worker.d.mts +0 -38
  138. package/dist/_internal/worker.d.mts.map +0 -1
  139. package/dist/_internal/worker.mjs +0 -4805
  140. package/dist/_internal/worker.mjs.map +0 -1
  141. package/dist/api.cjs +0 -1274
  142. package/dist/api.d.cts +0 -265
  143. package/dist/api.d.cts.map +0 -1
  144. package/dist/api.d.mts +0 -265
  145. package/dist/api.d.mts.map +0 -1
  146. package/dist/api.mjs +0 -1270
  147. package/dist/api.mjs.map +0 -1
  148. package/dist/base-context-BUnL_9z8.mjs +0 -241
  149. package/dist/base-context-BUnL_9z8.mjs.map +0 -1
  150. package/dist/base-context-CFvO2N9I.cjs +0 -248
  151. package/dist/context/index.d.cts.map +0 -1
  152. package/dist/context/index.d.mts.map +0 -1
  153. package/dist/engine-context-BuD9AGfd.mjs +0 -41
  154. package/dist/engine-context-BuD9AGfd.mjs.map +0 -1
  155. package/dist/engine-context-NO6enYev.cjs +0 -45
  156. package/dist/execution-context-Cq9cjr28.mjs +0 -2571
  157. package/dist/execution-context-Cq9cjr28.mjs.map +0 -1
  158. package/dist/execution-context-CyDSAifN.cjs +0 -2615
  159. package/dist/fs-D1nIP45P.mjs +0 -226
  160. package/dist/fs-D1nIP45P.mjs.map +0 -1
  161. package/dist/fs-XogSgMqT.cjs +0 -262
  162. package/dist/index.d.cts.map +0 -1
  163. package/dist/index.d.mts.map +0 -1
  164. package/dist/index.mjs.map +0 -1
  165. package/dist/schemas.cjs +0 -9
  166. package/dist/schemas.d.cts +0 -127
  167. package/dist/schemas.d.cts.map +0 -1
  168. package/dist/schemas.d.mts +0 -127
  169. package/dist/schemas.d.mts.map +0 -1
  170. package/dist/schemas.mjs +0 -3
  171. package/dist/storage/index.cjs +0 -9
  172. package/dist/storage/index.d.cts +0 -419
  173. package/dist/storage/index.d.cts.map +0 -1
  174. package/dist/storage/index.d.mts +0 -419
  175. package/dist/storage/index.d.mts.map +0 -1
  176. package/dist/storage/index.mjs +0 -3
  177. package/dist/ts-morph-BaLPVAdB.cjs +0 -114
  178. package/dist/ts-morph-D0CaA37w.mjs +0 -102
  179. package/dist/ts-morph-D0CaA37w.mjs.map +0 -1
  180. package/dist/tsconfig-Cstsoprg.mjs +0 -155
  181. package/dist/tsconfig-Cstsoprg.mjs.map +0 -1
  182. package/dist/tsconfig-DeyWQC2N.cjs +0 -198
  183. package/dist/typescript/index.cjs +0 -13
  184. package/dist/typescript/index.d.cts +0 -106
  185. package/dist/typescript/index.d.cts.map +0 -1
  186. package/dist/typescript/index.d.mts +0 -106
  187. package/dist/typescript/index.d.mts.map +0 -1
  188. package/dist/typescript/index.mjs +0 -4
  189. package/dist/virtual-BNdKVkRw.cjs +0 -548
  190. package/dist/virtual-gIlTc3Lj.mjs +0 -513
  191. package/dist/virtual-gIlTc3Lj.mjs.map +0 -1
@@ -0,0 +1,419 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region \0rolldown/runtime.js
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
+ let _powerlines_core = require("@powerlines/core");
30
+ let _powerlines_core_lib_environment = require("@powerlines/core/lib/environment");
31
+ let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
32
+ let _stryke_path_append = require("@stryke/path/append");
33
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
34
+ let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
35
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
36
+ let _stryke_path_replace = require("@stryke/path/replace");
37
+ let chalk = require("chalk");
38
+ chalk = __toESM(chalk, 1);
39
+ let node_fs = require("node:fs");
40
+ let _powerlines_core_lib_generate_types = require("@powerlines/core/lib/generate-types");
41
+ let _powerlines_core_lib_install_dependencies = require("@powerlines/core/lib/install-dependencies");
42
+ let _powerlines_core_lib_meta = require("@powerlines/core/lib/meta");
43
+ let _powerlines_core_lib_typescript_tsconfig = require("@powerlines/core/lib/typescript/tsconfig");
44
+ let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
45
+ let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
46
+ let _stryke_convert_to_array = require("@stryke/convert/to-array");
47
+ let _stryke_fs_helpers = require("@stryke/fs/helpers");
48
+ let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
49
+ let _stryke_path_join = require("@stryke/path/join");
50
+ let _stryke_fs_list_files = require("@stryke/fs/list-files");
51
+ let handlebars = require("handlebars");
52
+ handlebars = __toESM(handlebars, 1);
53
+ let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
54
+ let _stryke_helpers_omit = require("@stryke/helpers/omit");
55
+ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
56
+ let _powerlines_core_context_execution_context = require("@powerlines/core/context/execution-context");
57
+ let _powerlines_core_lib_context_helpers = require("@powerlines/core/lib/context-helpers");
58
+
59
+ //#region src/api/prepare.ts
60
+ /**
61
+ * Prepare the project
62
+ *
63
+ * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.
64
+ */
65
+ async function prepare$1(context, skipTypes = false) {
66
+ const timer = context.timer("Preparation");
67
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
68
+ env.debug(`Initializing the processing options for the Powerlines project.`);
69
+ await context.callHook("configResolved", {
70
+ environment: env,
71
+ order: "pre"
72
+ });
73
+ await (0, _powerlines_core_lib_typescript_tsconfig.initializeTsconfig)(env);
74
+ await context.callHook("configResolved", {
75
+ environment: env,
76
+ order: "normal"
77
+ });
78
+ if (env.entry.length > 0) env.debug(`The configuration provided ${(0, _stryke_type_checks_is_object.isObject)(env.config.input) ? Object.keys(env.config.input).length : (0, _stryke_convert_to_array.toArray)(env.config.input).length} entry point(s), Powerlines has found ${env.entry.length} entry files(s) for the ${env.config.title} project${env.entry.length > 0 && env.entry.length < 10 ? `: \n${env.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}`);
79
+ else env.warn(`No entry files were found for the ${env.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
80
+ await (0, _powerlines_core_lib_typescript_tsconfig.resolveTsconfig)(env);
81
+ await (0, _powerlines_core_lib_install_dependencies.installDependencies)(env);
82
+ await context.callHook("configResolved", {
83
+ environment: env,
84
+ order: "post"
85
+ });
86
+ env.trace({
87
+ meta: { category: "config" },
88
+ message: `Powerlines configuration after configResolved hook: \n${(0, _powerlines_core_plugin_utils.formatConfig)(env.config)}`
89
+ });
90
+ if (!env.fs.existsSync(env.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(env.cachePath);
91
+ if (!env.fs.existsSync(env.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(env.dataPath);
92
+ await context.callHook("prepare", {
93
+ environment: env,
94
+ order: "pre"
95
+ });
96
+ await context.callHook("prepare", {
97
+ environment: env,
98
+ order: "normal"
99
+ });
100
+ await context.callHook("prepare", {
101
+ environment: env,
102
+ order: "post"
103
+ });
104
+ if (!skipTypes && env.config.output.types !== false) await (0, _powerlines_core_lib_generate_types.handleTypes)(context, env);
105
+ context.debug("Formatting files generated during the prepare step.");
106
+ await Promise.all([(0, _powerlines_core_lib_utilities_format.formatFolder)(env, env.builtinsPath), (0, _powerlines_core_lib_utilities_format.formatFolder)(env, env.entryPath)]);
107
+ await (0, _powerlines_core_lib_meta.writeMetaFile)(env);
108
+ env.persistedMeta = env.meta;
109
+ });
110
+ timer();
111
+ }
112
+
113
+ //#endregion
114
+ //#region src/api/build.ts
115
+ async function handleBuild(context, env) {
116
+ await context.callHook("build", {
117
+ environment: env,
118
+ order: "pre"
119
+ });
120
+ env.debug("Formatting the generated entry files before the build process starts.");
121
+ await (0, _powerlines_core.formatFolder)(env, env.entryPath);
122
+ await context.callHook("build", {
123
+ environment: env,
124
+ order: "normal"
125
+ });
126
+ if (env.config.output.copy) {
127
+ env.debug("Copying project's files from build output directory.");
128
+ const destinationPath = (0, _stryke_path_is_parent_path.isParentPath)((0, _stryke_path_append.appendPath)(env.config.output.path, env.config.cwd), (0, _stryke_path_append.appendPath)(env.config.root, env.config.cwd)) ? (0, _stryke_path_join_paths.joinPaths)(env.config.output.copy.path, (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(env.config.root, env.config.cwd), (0, _stryke_path_append.appendPath)(env.config.output.path, env.config.cwd))) : (0, _stryke_path_join_paths.joinPaths)(env.config.output.copy.path, "dist");
129
+ const sourcePath = env.config.output.path;
130
+ if ((0, node_fs.existsSync)(sourcePath) && sourcePath !== destinationPath) {
131
+ env.debug(`Copying files from project's build output directory (${env.config.output.path}) to the project's copy/publish directory (${destinationPath}).`);
132
+ await (0, _stryke_fs_copy_file.copyFiles)(sourcePath, destinationPath);
133
+ } else env.warn(`The source path for the copy operation ${!(0, node_fs.existsSync)(sourcePath) ? "does not exist" : "is the same as the destination path"}. Source: ${sourcePath}, Destination: ${destinationPath}. Skipping copying of build output files.`);
134
+ if (env.config.output.copy.assets && Array.isArray(env.config.output.copy.assets)) await Promise.all(env.config.output.copy.assets.map(async (asset) => {
135
+ env.trace(`Copying asset(s): ${chalk.default.redBright(env.config.cwd === asset.input ? asset.glob : (0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.input, env.config.cwd)))} -> ${chalk.default.greenBright((0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.output, env.config.cwd)))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk.default.yellowBright(i)).join(", ")})` : ""}`);
136
+ await env.fs.copy(asset, asset.output);
137
+ }));
138
+ } else env.debug("No copy configuration found for the project output. Skipping the copying of build output files.");
139
+ await context.callHook("build", {
140
+ environment: env,
141
+ order: "post"
142
+ });
143
+ }
144
+ /**
145
+ * Build the project
146
+ *
147
+ * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.
148
+ */
149
+ async function build$1(context) {
150
+ const timer = context.timer("Building");
151
+ await context.generateChecksum();
152
+ if (context.meta.checksum !== context.persistedMeta?.checksum || context.config.skipCache) {
153
+ context.info(!context.persistedMeta?.checksum ? "No previous build cache found. Preparing the project for the initial build." : context.meta.checksum !== context.persistedMeta.checksum ? "The project has been modified since the last time `prepare` was ran. Re-preparing the project." : "The project is configured to skip cache. Re-preparing the project.");
154
+ await prepare$1(context);
155
+ }
156
+ if (context.config.singleBuild) await handleBuild(context, await context.toEnvironment());
157
+ else await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
158
+ await handleBuild(context, env);
159
+ });
160
+ timer();
161
+ }
162
+
163
+ //#endregion
164
+ //#region src/api/clean.ts
165
+ /**
166
+ * Clean any previously prepared artifacts
167
+ *
168
+ * @param context - The execution context for the clean process, which provides access to the project configuration, environment, and utility functions for performing the clean operation. The context is used to manage the state and behavior of the clean process, allowing for hooks to be called at different stages of the clean and for environment-specific configurations to be applied.
169
+ */
170
+ async function clean$1(context) {
171
+ const timer = context.timer("Cleaning");
172
+ await prepare$1(context, true);
173
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
174
+ env.debug("Cleaning the project's dist and artifacts directories.");
175
+ await env.fs.remove((0, _stryke_path_join.joinPaths)(env.config.cwd, env.config.output.path));
176
+ await env.fs.remove((0, _stryke_path_join.joinPaths)(env.config.cwd, env.config.root, env.config.output.artifactsPath));
177
+ await context.callHook("clean", {
178
+ environment: env,
179
+ sequential: false
180
+ });
181
+ });
182
+ timer();
183
+ }
184
+
185
+ //#endregion
186
+ //#region src/api/create.ts
187
+ /**
188
+ * Create a new Powerlines project
189
+ *
190
+ * @param context - The execution context for the create process, which provides access to the project configuration, environment, and utility functions for performing the create operation. The context is used to manage the state and behavior of the create process, allowing for hooks to be called at different stages of the create and for environment-specific configurations to be applied.
191
+ */
192
+ async function create$1(context) {
193
+ const timer = context.timer("Create a New Project Generation");
194
+ await prepare$1(context, true);
195
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
196
+ env.debug("Initializing the processing options for the project.");
197
+ await context.callHook("create", {
198
+ environment: env,
199
+ order: "pre"
200
+ });
201
+ const files = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join.joinPaths)(env.powerlinesPath, "files/common/**/*.hbs"));
202
+ for (const file of files) {
203
+ env.trace(`Adding template file to project: ${file}`);
204
+ const template = handlebars.default.compile(file);
205
+ await env.fs.write((0, _stryke_path_join.joinPaths)(env.config.root, file.replace(".hbs", "")), template(env));
206
+ }
207
+ await context.callHook("create", {
208
+ environment: env,
209
+ order: "normal"
210
+ });
211
+ if (env.config.projectType === "application") {
212
+ const appFiles = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join.joinPaths)(env.powerlinesPath, "files/application/**/*.hbs"));
213
+ for (const file of appFiles) {
214
+ env.trace(`Adding application template file: ${file}`);
215
+ const template = handlebars.default.compile(file);
216
+ await env.fs.write((0, _stryke_path_join.joinPaths)(env.config.root, file.replace(".hbs", "")), template(env));
217
+ }
218
+ } else {
219
+ const libFiles = await (0, _stryke_fs_list_files.listFiles)((0, _stryke_path_join.joinPaths)(env.powerlinesPath, "files/library/**/*.hbs"));
220
+ for (const file of libFiles) {
221
+ env.trace(`Adding library template file: ${file}`);
222
+ const template = handlebars.default.compile(file);
223
+ await env.fs.write((0, _stryke_path_join.joinPaths)(env.config.root, file.replace(".hbs", "")), template(env));
224
+ }
225
+ }
226
+ await context.callHook("create", {
227
+ environment: env,
228
+ order: "post"
229
+ });
230
+ });
231
+ timer();
232
+ }
233
+
234
+ //#endregion
235
+ //#region src/api/deploy.ts
236
+ /**
237
+ * Deploy the project's source files to the target environment.
238
+ *
239
+ * @remarks
240
+ * This function serves as the main entry point for the deployment process, orchestrating the execution of deployment hooks across different environments defined in the project configuration. It ensures that all relevant deployment operations are performed in a structured manner, allowing for pre-deployment, main deployment, and post-deployment hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the deployment operation, providing insights into the performance of the deployment process.
241
+ *
242
+ * @param context - The execution context for the deploy process, which provides access to the project configuration, environment, and utility functions for performing the deploy operation. The context is used to manage the state and behavior of the deploy process, allowing for hooks to be called at different stages of the deploy and for environment-specific configurations to be applied.
243
+ */
244
+ async function deploy$1(context) {
245
+ const timer = context.timer("Deployment");
246
+ await prepare$1(context);
247
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
248
+ await context.callHook("deploy", { environment: env });
249
+ });
250
+ timer();
251
+ }
252
+
253
+ //#endregion
254
+ //#region src/api/docs.ts
255
+ /**
256
+ * Generate the project's documentation.
257
+ *
258
+ * @remarks
259
+ * This function serves as the main entry point for the documentation generation process, orchestrating the execution of documentation hooks across different environments defined in the project configuration. It ensures that all relevant documentation operations are performed in a structured manner, allowing for pre-documentation, main documentation, and post-documentation hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the documentation operation, providing insights into the performance of the documentation process.
260
+ *
261
+ * @param context - The execution context for the documentation process, which provides access to the project configuration, environment, and utility functions for performing the documentation operation. The context is used to manage the state and behavior of the documentation process, allowing for hooks to be called at different stages of the documentation and for environment-specific configurations to be applied.
262
+ */
263
+ async function docs$1(context) {
264
+ const timer = context.timer("Documentation");
265
+ await prepare$1(context);
266
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
267
+ await context.callHook("docs", { environment: env });
268
+ });
269
+ timer();
270
+ }
271
+
272
+ //#endregion
273
+ //#region src/api/lint.ts
274
+ /**
275
+ * Lint the project's source files and report any issues found.
276
+ *
277
+ * @remarks
278
+ * This function serves as the main entry point for the linting process, orchestrating the execution of linting hooks across different environments defined in the project configuration. It ensures that all relevant linting operations are performed in a structured manner, allowing for pre-linting, main linting, and post-linting hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the linting operation, providing insights into the performance of the linting process.
279
+ *
280
+ * @param context - The execution context for the lint process, which provides access to the project configuration, environment, and utility functions for performing the lint operation. The context is used to manage the state and behavior of the lint process, allowing for hooks to be called at different stages of the lint and for environment-specific configurations to be applied.
281
+ */
282
+ async function lint$1(context) {
283
+ const timer = context.timer("Linting");
284
+ await prepare$1(context);
285
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
286
+ await context.callHook("lint", {
287
+ environment: env,
288
+ sequential: false
289
+ });
290
+ });
291
+ timer();
292
+ }
293
+
294
+ //#endregion
295
+ //#region src/api/test.ts
296
+ /**
297
+ * Test the project's source files and report any issues found.
298
+ *
299
+ * @remarks
300
+ * This function serves as the main entry point for the testing process, orchestrating the execution of testing hooks across different environments defined in the project configuration. It ensures that all relevant testing operations are performed in a structured manner, allowing for pre-testing, main testing, and post-testing hooks to be executed at the appropriate stages of the process. The function also utilizes a timer to measure the duration of the testing operation, providing insights into the performance of the testing process.
301
+ *
302
+ * @param context - The execution context for the test process, which provides access to the project configuration, environment, and utility functions for performing the test operation. The context is used to manage the state and behavior of the test process, allowing for hooks to be called at different stages of the test and for environment-specific configurations to be applied.
303
+ */
304
+ async function test$1(context) {
305
+ const timer = context.timer("Testing");
306
+ await prepare$1(context);
307
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
308
+ await context.callHook("test", {
309
+ environment: env,
310
+ sequential: false
311
+ });
312
+ });
313
+ timer();
314
+ }
315
+
316
+ //#endregion
317
+ //#region src/api/types.ts
318
+ /**
319
+ * Generate runtime types for the Powerlines project.
320
+ *
321
+ * @remarks
322
+ * This function is responsible for generating TypeScript declaration files based on the project's configuration and environment. It executes hooks at various stages of the type generation process, allowing for customization and extension by plugins. The generated types are formatted and written to the appropriate location in the project's file system, ensuring that they are available for use by other parts of the Powerlines system and by end-users of the project.
323
+ *
324
+ * @param context - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.
325
+ */
326
+ async function types$1(context) {
327
+ const timer = context.timer("Type Generation");
328
+ context.debug(" Aggregating configuration options for the Powerlines project");
329
+ await (0, _powerlines_core_lib_environment.executeEnvironments)(context, async (env) => {
330
+ env.debug(`Initializing the processing options for the Powerlines project.`);
331
+ await context.callHook("configResolved", {
332
+ environment: env,
333
+ order: "pre"
334
+ });
335
+ await (0, _powerlines_core_lib_typescript_tsconfig.initializeTsconfig)(env);
336
+ await context.callHook("configResolved", {
337
+ environment: env,
338
+ order: "normal"
339
+ });
340
+ if (env.entry.length > 0) env.debug(`The configuration provided ${(0, _stryke_type_checks_is_object.isObject)(env.config.input) ? Object.keys(env.config.input).length : (0, _stryke_convert_to_array.toArray)(env.config.input).length} entry point(s), Powerlines has found ${env.entry.length} entry files(s) for the ${env.config.title} project${env.entry.length > 0 && env.entry.length < 10 ? `: \n${env.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}`);
341
+ else env.warn(`No entry files were found for the ${env.config.title} project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`);
342
+ await (0, _powerlines_core_lib_typescript_tsconfig.resolveTsconfig)(env);
343
+ await (0, _powerlines_core_lib_install_dependencies.installDependencies)(env);
344
+ await context.callHook("configResolved", {
345
+ environment: env,
346
+ order: "post"
347
+ });
348
+ context.trace(`Powerlines configuration has been resolved: \n\n${(0, _storm_software_config_tools_logger.formatLogMessage)({
349
+ ...env.config,
350
+ userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(env.config.userConfig) ? (0, _stryke_helpers_omit.omit)(env.config.userConfig, ["plugins"]) : void 0,
351
+ inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(env.config.inlineConfig) ? env.config.inlineConfig : void 0,
352
+ plugins: env.plugins.map((plugin) => plugin.name)
353
+ })}`);
354
+ if (!env.fs.existsSync(env.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(env.cachePath);
355
+ if (!env.fs.existsSync(env.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(env.dataPath);
356
+ if (env.config.skipCache === true || env.persistedMeta?.checksum !== env.meta.checksum) env.debug(`Using previously prepared files as the meta checksum has not changed.`);
357
+ else {
358
+ env.info(`Running \`prepare\` command as the meta checksum has changed since the last run.`);
359
+ await prepare$1(context, true);
360
+ }
361
+ await (0, _powerlines_core_lib_generate_types.handleTypes)(context, env);
362
+ context.debug("Formatting files generated during the types step.");
363
+ await (0, _powerlines_core_lib_utilities_format.format)(env, env.typesPath, await env.fs.read(env.typesPath) ?? "");
364
+ await (0, _powerlines_core_lib_meta.writeMetaFile)(env);
365
+ env.persistedMeta = env.meta;
366
+ });
367
+ timer();
368
+ }
369
+
370
+ //#endregion
371
+ //#region src/helpers/create-execution-host.ts
372
+ /**
373
+ * Creates an execution host with the provided methods. Each method will be wrapped to create an execution context and handle errors appropriately.
374
+ *
375
+ * @param methods - An object where keys are method names and values are functions that take an execution context and return a promise.
376
+ * @returns An object with the same keys as the input methods, but each function is wrapped to create an execution context and handle errors.
377
+ */
378
+ function createExecutionHost(methods) {
379
+ return Object.fromEntries(Object.entries(methods).map(([method, fn]) => [method, async (params) => {
380
+ const context = await _powerlines_core_context_execution_context.PowerlinesExecutionContext.from(params.options, params.inlineConfig ?? {});
381
+ context.logger.info(`Starting ${method} execution (${params.options.executionId})`);
382
+ await (0, _powerlines_core_lib_context_helpers.resolvePluginConfig)(context);
383
+ await fn(context);
384
+ }]));
385
+ }
386
+
387
+ //#endregion
388
+ //#region src/execution-host.ts
389
+ const executionHost = createExecutionHost({
390
+ types: types$1,
391
+ prepare: prepare$1,
392
+ create: create$1,
393
+ clean: clean$1,
394
+ lint: lint$1,
395
+ test: test$1,
396
+ build: build$1,
397
+ docs: docs$1,
398
+ deploy: deploy$1
399
+ });
400
+ const types = executionHost.types;
401
+ const prepare = executionHost.prepare;
402
+ const create = executionHost.create;
403
+ const clean = executionHost.clean;
404
+ const lint = executionHost.lint;
405
+ const test = executionHost.test;
406
+ const build = executionHost.build;
407
+ const docs = executionHost.docs;
408
+ const deploy = executionHost.deploy;
409
+
410
+ //#endregion
411
+ exports.build = build;
412
+ exports.clean = clean;
413
+ exports.create = create;
414
+ exports.deploy = deploy;
415
+ exports.docs = docs;
416
+ exports.lint = lint;
417
+ exports.prepare = prepare;
418
+ exports.test = test;
419
+ exports.types = types;
@@ -0,0 +1,26 @@
1
+ import { ExecutionOptions, InlineConfig } from "@powerlines/core";
2
+ //#region src/types/api.d.ts
3
+ interface ExecutionHostParams {
4
+ /**
5
+ * The execution options for the current execution instance
6
+ */
7
+ options: ExecutionOptions;
8
+ /**
9
+ * The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
10
+ */
11
+ inlineConfig: InlineConfig;
12
+ }
13
+ //#endregion
14
+ //#region src/execution-host.d.ts
15
+ declare const types: ((params: ExecutionHostParams) => Promise<void>) | undefined;
16
+ declare const prepare: ((params: ExecutionHostParams) => Promise<void>) | undefined;
17
+ declare const create: ((params: ExecutionHostParams) => Promise<void>) | undefined;
18
+ declare const clean: ((params: ExecutionHostParams) => Promise<void>) | undefined;
19
+ declare const lint: ((params: ExecutionHostParams) => Promise<void>) | undefined;
20
+ declare const test: ((params: ExecutionHostParams) => Promise<void>) | undefined;
21
+ declare const build: ((params: ExecutionHostParams) => Promise<void>) | undefined;
22
+ declare const docs: ((params: ExecutionHostParams) => Promise<void>) | undefined;
23
+ declare const deploy: ((params: ExecutionHostParams) => Promise<void>) | undefined;
24
+ //#endregion
25
+ export { build, clean, create, deploy, docs, lint, prepare, test, types };
26
+ //# sourceMappingURL=execution-host.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-host.d.cts","names":[],"sources":["../../src/types/api.ts","../../src/execution-host.ts"],"mappings":";;UA4IiB,mBAAA;EC3FE;;;ED+FjB,OAAA,EAAS,gBAAA;EC/FQ;;;EDoGjB,YAAA,EAAc,YAAA;AAAA;;;cC5GH,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,OAAA,IAAO,MAAA,EAAwB,mBAAA,KAAxB,OAAA;AAAA,cACP,MAAA,IAAM,MAAA,EAAuB,mBAAA,KAAvB,OAAA;AAAA,cACN,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,MAAA,IAAM,MAAA,EAAuB,mBAAA,KAAvB,OAAA"}
@@ -0,0 +1,26 @@
1
+ import { ExecutionOptions, InlineConfig } from "@powerlines/core";
2
+ //#region src/types/api.d.ts
3
+ interface ExecutionHostParams {
4
+ /**
5
+ * The execution options for the current execution instance
6
+ */
7
+ options: ExecutionOptions;
8
+ /**
9
+ * The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
10
+ */
11
+ inlineConfig: InlineConfig;
12
+ }
13
+ //#endregion
14
+ //#region src/execution-host.d.ts
15
+ declare const types: ((params: ExecutionHostParams) => Promise<void>) | undefined;
16
+ declare const prepare: ((params: ExecutionHostParams) => Promise<void>) | undefined;
17
+ declare const create: ((params: ExecutionHostParams) => Promise<void>) | undefined;
18
+ declare const clean: ((params: ExecutionHostParams) => Promise<void>) | undefined;
19
+ declare const lint: ((params: ExecutionHostParams) => Promise<void>) | undefined;
20
+ declare const test: ((params: ExecutionHostParams) => Promise<void>) | undefined;
21
+ declare const build: ((params: ExecutionHostParams) => Promise<void>) | undefined;
22
+ declare const docs: ((params: ExecutionHostParams) => Promise<void>) | undefined;
23
+ declare const deploy: ((params: ExecutionHostParams) => Promise<void>) | undefined;
24
+ //#endregion
25
+ export { build, clean, create, deploy, docs, lint, prepare, test, types };
26
+ //# sourceMappingURL=execution-host.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-host.d.mts","names":[],"sources":["../../src/types/api.ts","../../src/execution-host.ts"],"mappings":";;UA4IiB,mBAAA;EC3FE;;;ED+FjB,OAAA,EAAS,gBAAA;EC/FQ;;;EDoGjB,YAAA,EAAc,YAAA;AAAA;;;cC5GH,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,OAAA,IAAO,MAAA,EAAwB,mBAAA,KAAxB,OAAA;AAAA,cACP,MAAA,IAAM,MAAA,EAAuB,mBAAA,KAAvB,OAAA;AAAA,cACN,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,KAAA,IAAK,MAAA,EAAsB,mBAAA,KAAtB,OAAA;AAAA,cACL,IAAA,IAAI,MAAA,EAAqB,mBAAA,KAArB,OAAA;AAAA,cACJ,MAAA,IAAM,MAAA,EAAuB,mBAAA,KAAvB,OAAA"}