@powerlines/engine 0.47.4 → 0.49.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 (249) 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 +28 -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 +24 -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 +24 -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 +27 -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 +68 -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 +27 -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 +70 -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-BgyEi2hF.d.mts +138 -0
  65. package/dist/api-BgyEi2hF.d.mts.map +1 -0
  66. package/dist/api-DcHfCjQK.d.cts +138 -0
  67. package/dist/api-DcHfCjQK.d.cts.map +1 -0
  68. package/dist/api.cjs +39 -1268
  69. package/dist/api.d.cts +11 -300
  70. package/dist/api.d.cts.map +1 -1
  71. package/dist/api.d.mts +11 -300
  72. package/dist/api.d.mts.map +1 -1
  73. package/dist/api.mjs +31 -1264
  74. package/dist/api.mjs.map +1 -1
  75. package/dist/config-ByLyzMI0.d.mts +204 -0
  76. package/dist/config-ByLyzMI0.d.mts.map +1 -0
  77. package/dist/config-DKEmqMrh.d.cts +204 -0
  78. package/dist/config-DKEmqMrh.d.cts.map +1 -0
  79. package/dist/context/engine-context.cjs +177 -0
  80. package/dist/context/engine-context.d.cts +2 -0
  81. package/dist/context/engine-context.d.mts +2 -0
  82. package/dist/context/engine-context.mjs +175 -0
  83. package/dist/context/engine-context.mjs.map +1 -0
  84. package/dist/context/index.cjs +2 -9
  85. package/dist/context/index.d.cts +2 -150
  86. package/dist/context/index.d.mts +2 -150
  87. package/dist/context/index.mjs +2 -4
  88. package/dist/context-D0_a0kRO.d.cts +149 -0
  89. package/dist/context-D0_a0kRO.d.cts.map +1 -0
  90. package/dist/context-DcXV6_GL.d.mts +149 -0
  91. package/dist/context-DcXV6_GL.d.mts.map +1 -0
  92. package/dist/engine-Dz6BvkFY.cjs +590 -0
  93. package/dist/engine-context-B8K6Jtkk.d.cts +53 -0
  94. package/dist/engine-context-B8K6Jtkk.d.cts.map +1 -0
  95. package/dist/engine-context-DKlA5Pgu.d.mts +53 -0
  96. package/dist/engine-context-DKlA5Pgu.d.mts.map +1 -0
  97. package/dist/engine-q6YKXXcB.mjs +571 -0
  98. package/dist/engine-q6YKXXcB.mjs.map +1 -0
  99. package/dist/engine.cjs +6 -0
  100. package/dist/engine.d.cts +143 -0
  101. package/dist/engine.d.cts.map +1 -0
  102. package/dist/engine.d.mts +143 -0
  103. package/dist/engine.d.mts.map +1 -0
  104. package/dist/engine.mjs +3 -0
  105. package/dist/helpers/create-execution-host.cjs +57 -0
  106. package/dist/helpers/create-execution-host.d.cts +20 -0
  107. package/dist/helpers/create-execution-host.d.cts.map +1 -0
  108. package/dist/helpers/create-execution-host.d.mts +20 -0
  109. package/dist/helpers/create-execution-host.d.mts.map +1 -0
  110. package/dist/helpers/create-execution-host.mjs +57 -0
  111. package/dist/helpers/create-execution-host.mjs.map +1 -0
  112. package/dist/helpers/finalize.cjs +26 -0
  113. package/dist/helpers/finalize.d.cts +12 -0
  114. package/dist/helpers/finalize.d.cts.map +1 -0
  115. package/dist/helpers/finalize.d.mts +12 -0
  116. package/dist/helpers/finalize.d.mts.map +1 -0
  117. package/dist/helpers/finalize.mjs +26 -0
  118. package/dist/helpers/finalize.mjs.map +1 -0
  119. package/dist/helpers/index.cjs +12 -0
  120. package/dist/helpers/index.d.cts +5 -0
  121. package/dist/helpers/index.d.mts +5 -0
  122. package/dist/helpers/index.mjs +6 -0
  123. package/dist/helpers/rpc.cjs +139 -0
  124. package/dist/helpers/rpc.d.cts +7 -0
  125. package/dist/helpers/rpc.d.cts.map +1 -0
  126. package/dist/helpers/rpc.d.mts +7 -0
  127. package/dist/helpers/rpc.d.mts.map +1 -0
  128. package/dist/helpers/rpc.mjs +139 -0
  129. package/dist/helpers/rpc.mjs.map +1 -0
  130. package/dist/helpers/stream.cjs +119 -0
  131. package/dist/helpers/stream.d.cts +45 -0
  132. package/dist/helpers/stream.d.cts.map +1 -0
  133. package/dist/helpers/stream.d.mts +45 -0
  134. package/dist/helpers/stream.d.mts.map +1 -0
  135. package/dist/helpers/stream.mjs +117 -0
  136. package/dist/helpers/stream.mjs.map +1 -0
  137. package/dist/index-BVVgDSdq.d.cts +1 -0
  138. package/dist/index-BVVgDSdq.d.mts +1 -0
  139. package/dist/index.cjs +8 -748
  140. package/dist/index.d.cts +6 -140
  141. package/dist/index.d.mts +6 -140
  142. package/dist/index.mjs +4 -747
  143. package/package.json +102 -132
  144. package/dist/_internal/worker.cjs +0 -5192
  145. package/dist/_internal/worker.d.cts +0 -46
  146. package/dist/_internal/worker.d.cts.map +0 -1
  147. package/dist/_internal/worker.d.mts +0 -46
  148. package/dist/_internal/worker.d.mts.map +0 -1
  149. package/dist/_internal/worker.mjs +0 -5153
  150. package/dist/_internal/worker.mjs.map +0 -1
  151. package/dist/base-context-DLemGRbd.cjs +0 -322
  152. package/dist/base-context-DUha4Lz-.mjs +0 -315
  153. package/dist/base-context-DUha4Lz-.mjs.map +0 -1
  154. package/dist/context/index.d.cts.map +0 -1
  155. package/dist/context/index.d.mts.map +0 -1
  156. package/dist/engine-context-BfFiKN53.mjs +0 -86
  157. package/dist/engine-context-BfFiKN53.mjs.map +0 -1
  158. package/dist/engine-context-D0y88i_J.cjs +0 -91
  159. package/dist/execution-context-CE5H90Um.mjs +0 -2845
  160. package/dist/execution-context-CE5H90Um.mjs.map +0 -1
  161. package/dist/execution-context-CnyaM3Ul.cjs +0 -2889
  162. package/dist/execution-context-NyDjVZ6T.d.cts +0 -647
  163. package/dist/execution-context-NyDjVZ6T.d.cts.map +0 -1
  164. package/dist/execution-context-YrjFeD9k.d.mts +0 -647
  165. package/dist/execution-context-YrjFeD9k.d.mts.map +0 -1
  166. package/dist/fs-CeEdzPKE.cjs +0 -262
  167. package/dist/fs-Dcle8lUp.mjs +0 -226
  168. package/dist/fs-Dcle8lUp.mjs.map +0 -1
  169. package/dist/index.d.cts.map +0 -1
  170. package/dist/index.d.mts.map +0 -1
  171. package/dist/index.mjs.map +0 -1
  172. package/dist/rpc/client.cjs +0 -74
  173. package/dist/rpc/client.d.cts +0 -31
  174. package/dist/rpc/client.d.cts.map +0 -1
  175. package/dist/rpc/client.d.mts +0 -31
  176. package/dist/rpc/client.d.mts.map +0 -1
  177. package/dist/rpc/client.mjs +0 -71
  178. package/dist/rpc/client.mjs.map +0 -1
  179. package/dist/rpc/serialization.cjs +0 -82
  180. package/dist/rpc/serialization.d.cts +0 -46
  181. package/dist/rpc/serialization.d.cts.map +0 -1
  182. package/dist/rpc/serialization.d.mts +0 -46
  183. package/dist/rpc/serialization.d.mts.map +0 -1
  184. package/dist/rpc/serialization.mjs +0 -76
  185. package/dist/rpc/serialization.mjs.map +0 -1
  186. package/dist/rpc/server.cjs +0 -69
  187. package/dist/rpc/server.d.cts +0 -29
  188. package/dist/rpc/server.d.cts.map +0 -1
  189. package/dist/rpc/server.d.mts +0 -29
  190. package/dist/rpc/server.d.mts.map +0 -1
  191. package/dist/rpc/server.mjs +0 -66
  192. package/dist/rpc/server.mjs.map +0 -1
  193. package/dist/rpc/types.cjs +0 -0
  194. package/dist/rpc/types.d.cts +0 -70
  195. package/dist/rpc/types.d.cts.map +0 -1
  196. package/dist/rpc/types.d.mts +0 -70
  197. package/dist/rpc/types.d.mts.map +0 -1
  198. package/dist/rpc/types.mjs +0 -1
  199. package/dist/schemas.cjs +0 -9
  200. package/dist/schemas.d.cts +0 -127
  201. package/dist/schemas.d.cts.map +0 -1
  202. package/dist/schemas.d.mts +0 -127
  203. package/dist/schemas.d.mts.map +0 -1
  204. package/dist/schemas.mjs +0 -3
  205. package/dist/storage/base.cjs +0 -216
  206. package/dist/storage/base.d.cts +0 -199
  207. package/dist/storage/base.d.cts.map +0 -1
  208. package/dist/storage/base.d.mts +0 -199
  209. package/dist/storage/base.d.mts.map +0 -1
  210. package/dist/storage/base.mjs +0 -215
  211. package/dist/storage/base.mjs.map +0 -1
  212. package/dist/storage/file-system.cjs +0 -180
  213. package/dist/storage/file-system.d.cts +0 -127
  214. package/dist/storage/file-system.d.cts.map +0 -1
  215. package/dist/storage/file-system.d.mts +0 -127
  216. package/dist/storage/file-system.d.mts.map +0 -1
  217. package/dist/storage/file-system.mjs +0 -179
  218. package/dist/storage/file-system.mjs.map +0 -1
  219. package/dist/storage/helpers.cjs +0 -37
  220. package/dist/storage/helpers.d.cts +0 -25
  221. package/dist/storage/helpers.d.cts.map +0 -1
  222. package/dist/storage/helpers.d.mts +0 -25
  223. package/dist/storage/helpers.d.mts.map +0 -1
  224. package/dist/storage/helpers.mjs +0 -34
  225. package/dist/storage/helpers.mjs.map +0 -1
  226. package/dist/storage/index.cjs +0 -12
  227. package/dist/storage/index.d.cts +0 -5
  228. package/dist/storage/index.d.mts +0 -5
  229. package/dist/storage/index.mjs +0 -6
  230. package/dist/storage/virtual.cjs +0 -98
  231. package/dist/storage/virtual.d.cts +0 -80
  232. package/dist/storage/virtual.d.cts.map +0 -1
  233. package/dist/storage/virtual.d.mts +0 -80
  234. package/dist/storage/virtual.d.mts.map +0 -1
  235. package/dist/storage/virtual.mjs +0 -97
  236. package/dist/storage/virtual.mjs.map +0 -1
  237. package/dist/ts-morph-BbM83PT9.cjs +0 -114
  238. package/dist/ts-morph-C6YBNc46.mjs +0 -102
  239. package/dist/ts-morph-C6YBNc46.mjs.map +0 -1
  240. package/dist/tsconfig-DeKMGasE.cjs +0 -198
  241. package/dist/tsconfig-HzJsMUrr.mjs +0 -155
  242. package/dist/tsconfig-HzJsMUrr.mjs.map +0 -1
  243. package/dist/typescript/index.cjs +0 -13
  244. package/dist/typescript/index.d.cts +0 -106
  245. package/dist/typescript/index.d.cts.map +0 -1
  246. package/dist/typescript/index.d.mts +0 -106
  247. package/dist/typescript/index.d.mts.map +0 -1
  248. package/dist/typescript/index.mjs +0 -4
  249. /package/dist/{chunk-C0xms8kb.cjs → chunk-C_NdSu1c.cjs} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-context-DUha4Lz-.mjs","names":["#timestamp","createLogger","joinPaths"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.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 { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Partial<Pick<ResolvedConfig, \"mode\" | \"skipCache\">> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\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 {\n BaseContext,\n EngineOptions,\n LogFn,\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): number {\n return this.#timestamp;\n }\n\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.options.logLevel, this.options.mode);\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n });\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\n\n /**\n * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context\n */\n protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n */\n protected async init() {\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n await this.resolvePackageConfigs();\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n }\n }\n\n /**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACb,UAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACLT,IAAa,wBAAb,MAA0D;CACxD,aAAqB,KAAK,KAAK;;;;CAK/B,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAQP,AAAO;;;;CAKP,AAAO,cAA+C;;;;CAKtD,AAAO;;;;CAKP,IAAW,SAAiB;AAC1B,SAAO,KAAK,aAAa,EAAE,CAA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AAK,aAAa,OAAO,GAC/D,UAAU,KAAK,aAAa,QAAQ,KAAK,GACzC,UAAU,KAAK,aAAa,OAAO;;;;;;;;;CAU7C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,uBAAA,SACH,qBAAA,YACG,aAAA;EAAA;;AAFb;;;;;SAYsB,iBAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA,IAC1B,OAAA,CAAQ,uBAAA;EAAA;;;EAAA,SAUc,cAAA,EAAgB,aAAA;EAKD;;;EAAA,SAAf,aAAA,EAAe,WAAA,CAAY,UAAA;EAYxC;;;EAPI,OAAA,EAAS,YAAA,CACvB,IAAA,CAAK,aAAA;IAsCsB;;;IAhC3B,QAAA,EAAU,sBAAA;EAAA;EAxCY;;;;;;EAAA,UAyDf,WAAA,CACP,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA;EA/CZ;;;;;;EAAA,UA4DQ,IAAA,CAAA,GAAI,OAAA;EA5CJ;;;;;EAAA,IAmFd,UAAA,CAAA,GAAc,cAAA;AAAA;;;cClFd,4BAAA,yBACa,cAAA,GAAiB,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BAAA,CAChB,yBAAA,CAA0B,eAAA;EApPZ;;;;;EAAA,UAsQC,WAAA,CAAA,GAAe,yBAAA,CAA0B,eAAA;AAAA;;;;;;ADtU9D;;;;;iBEagB,mBAAA,yBACU,cAAA,GAAiB,cAAA,CAAA,CAEzC,QAAA,UACA,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,IAC7B,WAAA,EAAa,4BAAA,CAA6B,eAAA,IACzC,sBAAA,CAAuB,eAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,uBAAA,SACH,qBAAA,YACG,aAAA;EAAA;;AAFb;;;;;SAYsB,iBAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA,IAC1B,OAAA,CAAQ,uBAAA;EAAA;;;EAAA,SAUc,cAAA,EAAgB,aAAA;EAKD;;;EAAA,SAAf,aAAA,EAAe,WAAA,CAAY,UAAA;EAYxC;;;EAPI,OAAA,EAAS,YAAA,CACvB,IAAA,CAAK,aAAA;IAsCsB;;;IAhC3B,QAAA,EAAU,sBAAA;EAAA;EAxCY;;;;;;EAAA,UAyDf,WAAA,CACP,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA;EA/CZ;;;;;;EAAA,UA4DQ,IAAA,CAAA,GAAI,OAAA;EA5CJ;;;;;EAAA,IAmFd,UAAA,CAAA,GAAc,cAAA;AAAA;;;cClFd,4BAAA,yBACa,cAAA,GAAiB,cAAA,UAEjC,iBAAA,CAAkB,yBAAA,CAA0B,eAAA,cACzC,2BAAA,CAA4B,eAAA;EAAA;;ADnCzC;;;;;;;;SC6DsB,iBAAA,yBACM,cAAA,GAAiB,cAAA,CAAA,CAEzC,cAAA,EAAgB,gBAAA,EAChB,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,y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7B,WAAA,EAAa,4BAAA,CAA6B,eAAA,IACzC,sBAAA,CAAuB,eAAA"}
@@ -1,86 +0,0 @@
1
- import { t as PowerlinesBaseContext } from "./base-context-DUha4Lz-.mjs";
2
- import { uuid } from "@stryke/unique-id/uuid";
3
- import { toArray } from "@stryke/convert/to-array";
4
-
5
- //#region src/context/engine-context.ts
6
- var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBaseContext {
7
- #executions = [];
8
- /**
9
- * Creates a new instance of the PowerlinesEngineContext class.
10
- *
11
- * @param options - The options to initialize the context with.
12
- * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
13
- */
14
- static async fromInitialConfig(options, initialConfig = {}) {
15
- const context = new PowerlinesEngineContext(options, initialConfig);
16
- await context.init();
17
- return context;
18
- }
19
- /**
20
- * The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
21
- */
22
- initialOptions;
23
- /**
24
- * The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
25
- */
26
- initialConfig;
27
- /**
28
- * The options provided to the Powerlines process
29
- */
30
- options = {};
31
- /**
32
- * Creates a new Context instance.
33
- *
34
- * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
35
- * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.
36
- */
37
- constructor(options, initialConfig = {}) {
38
- super(options, initialConfig);
39
- this.initialOptions = options;
40
- this.initialConfig = initialConfig;
41
- }
42
- /**
43
- * Initialize the context with the provided configuration options
44
- *
45
- * @remarks
46
- * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
47
- */
48
- async init() {
49
- await super.init();
50
- if (!this.configFile?.config) {
51
- this.fatal("No configuration file found. Please ensure you have a valid configuration file in your project.");
52
- throw new Error("No configuration file found");
53
- }
54
- this.#executions = await Promise.all(toArray(this.configFile.config).map(async (_, executionIndex) => {
55
- const executionId = uuid();
56
- return {
57
- executionId,
58
- options: {
59
- cwd: this.options.cwd,
60
- root: this.options.root,
61
- configFile: this.options.configFile,
62
- ...this.initialOptions,
63
- executionId,
64
- executionIndex
65
- },
66
- active: {
67
- command: null,
68
- hook: null,
69
- plugin: null
70
- }
71
- };
72
- }));
73
- }
74
- /**
75
- * A list of all command executions that will be run during the lifecycle of the engine
76
- *
77
- * @returns An array of {@link ExecutionState} representing each execution context for the engine.
78
- */
79
- get executions() {
80
- return this.#executions;
81
- }
82
- };
83
-
84
- //#endregion
85
- export { PowerlinesEngineContext as t };
86
- //# sourceMappingURL=engine-context-BfFiKN53.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine-context-BfFiKN53.mjs","names":["#executions"],"sources":["../src/context/engine-context.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 {\n EngineContext,\n EngineOptions,\n ExecutionState,\n LogLevelResolvedConfig,\n UserConfig\n} from \"@powerlines/core\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ExecutionState[] = [];\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async fromInitialConfig(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext(options, initialConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialOptions: EngineOptions;\n\n /**\n * The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialConfig: DeepPartial<UserConfig>;\n\n /**\n * The options provided to the Powerlines process\n */\n public override options: RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n } = {} as RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n };\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n super(options, initialConfig);\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n */\n protected override async init() {\n await super.init();\n\n if (!this.configFile?.config) {\n this.fatal(\n \"No configuration file found. Please ensure you have a valid configuration file in your project.\"\n );\n throw new Error(\"No configuration file found\");\n }\n\n this.#executions = await Promise.all(\n toArray(this.configFile.config).map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n cwd: this.options.cwd,\n root: this.options.root,\n configFile: this.options.configFile,\n ...this.initialOptions,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n }\n\n /**\n * A list of all command executions that will be run during the lifecycle of the engine\n *\n * @returns An array of {@link ExecutionState} representing each execution context for the engine.\n */\n public get executions(): ExecutionState[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;;;AA8BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,kBAClB,SACA,gBAAyC,EAAE,EACT;EAClC,MAAM,UAAU,IAAI,wBAAwB,SAAS,cAAc;AACnE,QAAM,QAAQ,MAAM;AAEpB,SAAO;;;;;CAMT,AAAyB;;;;CAKzB,AAAyB;;;;CAKzB,AAAgB,UAQZ,EAAE;;;;;;;CAgBN,AAAU,YACR,SACA,gBAAyC,EAAE,EAC3C;AACA,QAAM,SAAS,cAAc;AAC7B,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;;;;;;;;CASvB,MAAyB,OAAO;AAC9B,QAAM,MAAM,MAAM;AAElB,MAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,QAAK,MACH,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,QAAKA,aAAc,MAAM,QAAQ,IAC/B,QAAQ,KAAK,WAAW,OAAO,CAAC,IAAI,OAAO,GAAG,mBAAmB;GAC/D,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,KAAK,KAAK,QAAQ;KAClB,MAAM,KAAK,QAAQ;KACnB,YAAY,KAAK,QAAQ;KACzB,GAAG,KAAK;KACR;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;;;;;;;CAQH,IAAW,aAA+B;AACxC,SAAO,MAAKA"}
@@ -1,91 +0,0 @@
1
- const require_chunk = require('./chunk-C0xms8kb.cjs');
2
- const require_base_context = require('./base-context-DLemGRbd.cjs');
3
- let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
4
- let _stryke_convert_to_array = require("@stryke/convert/to-array");
5
-
6
- //#region src/context/engine-context.ts
7
- var PowerlinesEngineContext = class PowerlinesEngineContext extends require_base_context.PowerlinesBaseContext {
8
- #executions = [];
9
- /**
10
- * Creates a new instance of the PowerlinesEngineContext class.
11
- *
12
- * @param options - The options to initialize the context with.
13
- * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
14
- */
15
- static async fromInitialConfig(options, initialConfig = {}) {
16
- const context = new PowerlinesEngineContext(options, initialConfig);
17
- await context.init();
18
- return context;
19
- }
20
- /**
21
- * The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
22
- */
23
- initialOptions;
24
- /**
25
- * The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
26
- */
27
- initialConfig;
28
- /**
29
- * The options provided to the Powerlines process
30
- */
31
- options = {};
32
- /**
33
- * Creates a new Context instance.
34
- *
35
- * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
36
- * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.
37
- */
38
- constructor(options, initialConfig = {}) {
39
- super(options, initialConfig);
40
- this.initialOptions = options;
41
- this.initialConfig = initialConfig;
42
- }
43
- /**
44
- * Initialize the context with the provided configuration options
45
- *
46
- * @remarks
47
- * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
48
- */
49
- async init() {
50
- await super.init();
51
- if (!this.configFile?.config) {
52
- this.fatal("No configuration file found. Please ensure you have a valid configuration file in your project.");
53
- throw new Error("No configuration file found");
54
- }
55
- this.#executions = await Promise.all((0, _stryke_convert_to_array.toArray)(this.configFile.config).map(async (_, executionIndex) => {
56
- const executionId = (0, _stryke_unique_id_uuid.uuid)();
57
- return {
58
- executionId,
59
- options: {
60
- cwd: this.options.cwd,
61
- root: this.options.root,
62
- configFile: this.options.configFile,
63
- ...this.initialOptions,
64
- executionId,
65
- executionIndex
66
- },
67
- active: {
68
- command: null,
69
- hook: null,
70
- plugin: null
71
- }
72
- };
73
- }));
74
- }
75
- /**
76
- * A list of all command executions that will be run during the lifecycle of the engine
77
- *
78
- * @returns An array of {@link ExecutionState} representing each execution context for the engine.
79
- */
80
- get executions() {
81
- return this.#executions;
82
- }
83
- };
84
-
85
- //#endregion
86
- Object.defineProperty(exports, 'PowerlinesEngineContext', {
87
- enumerable: true,
88
- get: function () {
89
- return PowerlinesEngineContext;
90
- }
91
- });