powerlines 0.42.32 → 0.42.34

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 (122) hide show
  1. package/dist/api-0aKfs398.mjs +1010 -0
  2. package/dist/api-0aKfs398.mjs.map +1 -0
  3. package/dist/api-7bOKZ8DC.cjs +1030 -0
  4. package/dist/{api-context-k3dnn5KR.cjs → api-context-4t-rlsAr.cjs} +64 -442
  5. package/dist/{api-context-BQi9M07D.mjs → api-context-CmuOyg7q.mjs} +62 -432
  6. package/dist/api-context-CmuOyg7q.mjs.map +1 -0
  7. package/dist/astro.mjs.map +1 -1
  8. package/dist/{chunk-7azAqIA9.cjs → chunk-AIJqnxB6.cjs} +0 -7
  9. package/dist/{chunk-WJdhOJK3.mjs → chunk-CtajNgzt.mjs} +1 -10
  10. package/dist/config.cjs +1 -1
  11. package/dist/config.mjs +1 -1
  12. package/dist/constants.cjs +1 -1
  13. package/dist/constants.mjs +1 -1
  14. package/dist/context/index.cjs +1 -1
  15. package/dist/context/index.d.cts +11 -260
  16. package/dist/context/index.d.cts.map +1 -1
  17. package/dist/context/index.d.mts +12 -261
  18. package/dist/context/index.d.mts.map +1 -1
  19. package/dist/context/index.mjs +1 -1
  20. package/dist/esbuild.cjs +9 -4
  21. package/dist/esbuild.d.cts +2 -2
  22. package/dist/esbuild.d.cts.map +1 -1
  23. package/dist/esbuild.d.mts +2 -2
  24. package/dist/esbuild.d.mts.map +1 -1
  25. package/dist/esbuild.mjs +2 -2
  26. package/dist/esbuild.mjs.map +1 -1
  27. package/dist/farm.cjs +1 -1
  28. package/dist/index.cjs +3 -3
  29. package/dist/index.d.cts +1 -1
  30. package/dist/index.d.mts +2 -2
  31. package/dist/index.mjs +2 -2
  32. package/dist/next.mjs.map +1 -1
  33. package/dist/nuxt.cjs +2 -2
  34. package/dist/nuxt.d.mts +1 -1
  35. package/dist/nuxt.mjs +1 -1
  36. package/dist/nuxt.mjs.map +1 -1
  37. package/dist/plugin-utils.cjs +1 -1
  38. package/dist/plugin-utils.mjs +1 -1
  39. package/dist/rolldown.cjs +7 -2
  40. package/dist/rolldown.d.cts +2 -2
  41. package/dist/rolldown.d.cts.map +1 -1
  42. package/dist/rolldown.d.mts +2 -2
  43. package/dist/rolldown.d.mts.map +1 -1
  44. package/dist/rolldown.mjs +2 -2
  45. package/dist/rolldown.mjs.map +1 -1
  46. package/dist/rollup.cjs +7 -2
  47. package/dist/rollup.d.cts +2 -2
  48. package/dist/rollup.d.cts.map +1 -1
  49. package/dist/rollup.d.mts +2 -2
  50. package/dist/rollup.d.mts.map +1 -1
  51. package/dist/rollup.mjs +2 -2
  52. package/dist/rollup.mjs.map +1 -1
  53. package/dist/rspack.cjs +7 -2
  54. package/dist/rspack.d.cts +2 -2
  55. package/dist/rspack.d.cts.map +1 -1
  56. package/dist/rspack.d.mts +2 -2
  57. package/dist/rspack.d.mts.map +1 -1
  58. package/dist/rspack.mjs +2 -2
  59. package/dist/rspack.mjs.map +1 -1
  60. package/dist/storage/index.cjs +1 -1
  61. package/dist/storage/index.d.cts +1 -1
  62. package/dist/storage/index.d.mts +2 -2
  63. package/dist/storage/index.mjs +1 -1
  64. package/dist/ts-morph-B85ZbV1Q.mjs +102 -0
  65. package/dist/ts-morph-B85ZbV1Q.mjs.map +1 -0
  66. package/dist/ts-morph-Cf4wz3E0.cjs +114 -0
  67. package/dist/{tsconfig-BhVGZ2DK.cjs → tsconfig-ChmbpAO7.cjs} +2 -2
  68. package/dist/{tsconfig-CzYPBpDS.mjs → tsconfig-DoV1dUYg.mjs} +2 -2
  69. package/dist/{tsconfig-CzYPBpDS.mjs.map → tsconfig-DoV1dUYg.mjs.map} +1 -1
  70. package/dist/tsdown.cjs +8 -3
  71. package/dist/tsdown.d.cts +2 -2
  72. package/dist/tsdown.d.cts.map +1 -1
  73. package/dist/tsdown.d.mts +2 -2
  74. package/dist/tsdown.d.mts.map +1 -1
  75. package/dist/tsdown.mjs +3 -3
  76. package/dist/tsdown.mjs.map +1 -1
  77. package/dist/tsup.cjs +8 -3
  78. package/dist/tsup.d.cts +3 -547
  79. package/dist/tsup.d.cts.map +1 -1
  80. package/dist/tsup.d.mts +3 -547
  81. package/dist/tsup.d.mts.map +1 -1
  82. package/dist/tsup.mjs +3 -3
  83. package/dist/tsup.mjs.map +1 -1
  84. package/dist/{types-hdziyQIH.d.mts → types-9O-s0Fpu.d.mts} +1 -1
  85. package/dist/types-9O-s0Fpu.d.mts.map +1 -0
  86. package/dist/typescript/index.cjs +4 -104
  87. package/dist/typescript/index.d.cts +1 -6
  88. package/dist/typescript/index.d.cts.map +1 -1
  89. package/dist/typescript/index.d.mts +2 -7
  90. package/dist/typescript/index.d.mts.map +1 -1
  91. package/dist/typescript/index.mjs +3 -102
  92. package/dist/unloader.cjs +1 -1
  93. package/dist/unplugin.cjs +2 -2
  94. package/dist/unplugin.mjs +1 -1
  95. package/dist/utils.cjs +1 -1
  96. package/dist/utils.mjs +1 -1
  97. package/dist/{virtual-BHb4iMd_.cjs → virtual-BNy8T32w.cjs} +3 -3
  98. package/dist/{virtual-OEHgBu0s.mjs → virtual-PaZGNIrj.mjs} +3 -3
  99. package/dist/{virtual-OEHgBu0s.mjs.map → virtual-PaZGNIrj.mjs.map} +1 -1
  100. package/dist/vite.cjs +7 -2
  101. package/dist/vite.d.cts +2 -2
  102. package/dist/vite.d.mts +2 -2
  103. package/dist/vite.mjs +2 -2
  104. package/dist/vite.mjs.map +1 -1
  105. package/dist/webpack.cjs +7 -2
  106. package/dist/webpack.d.cts +2 -2
  107. package/dist/webpack.d.cts.map +1 -1
  108. package/dist/webpack.d.mts +2 -2
  109. package/dist/webpack.d.mts.map +1 -1
  110. package/dist/webpack.mjs +2 -2
  111. package/dist/webpack.mjs.map +1 -1
  112. package/package.json +14 -13
  113. package/dist/api-D6i8MmbC.mjs +0 -6063
  114. package/dist/api-D6i8MmbC.mjs.map +0 -1
  115. package/dist/api-DZoRNTY7.cjs +0 -6083
  116. package/dist/api-context-BQi9M07D.mjs.map +0 -1
  117. package/dist/base-Bl_AMAlI.d.cts +0 -12
  118. package/dist/base-Bl_AMAlI.d.cts.map +0 -1
  119. package/dist/base-hjCHfNY6.d.mts +0 -12
  120. package/dist/base-hjCHfNY6.d.mts.map +0 -1
  121. package/dist/types-hdziyQIH.d.mts.map +0 -1
  122. package/dist/typescript/index.mjs.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import { t as utils_exports } from "./utils.mjs";
2
2
  import { t as plugin_utils_exports } from "./plugin-utils.mjs";
3
3
  import { t as constants_exports } from "./constants.mjs";
4
- import { i as getTsconfigFilePath } from "./tsconfig-CzYPBpDS.mjs";
4
+ import { i as getTsconfigFilePath } from "./tsconfig-DoV1dUYg.mjs";
5
5
  import { t as config_exports } from "./config.mjs";
6
- import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-OEHgBu0s.mjs";
6
+ import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-PaZGNIrj.mjs";
7
7
  import { relativeToWorkspaceRoot } from "@stryke/fs/get-workspace-root";
8
8
  import { toArray } from "@stryke/convert/to-array";
9
9
  import { existsSync } from "@stryke/fs/exists";
@@ -22,13 +22,10 @@ import { isSet } from "@stryke/type-checks/is-set";
22
22
  import { isSetObject } from "@stryke/type-checks/is-set-object";
23
23
  import { isSetString } from "@stryke/type-checks/is-set-string";
24
24
  import { isString } from "@stryke/type-checks/is-string";
25
- import process from "node:process";
26
- import os from "node:os";
27
- import tty from "node:tty";
25
+ import chalk from "chalk";
28
26
  import defu$1, { createDefu, defu } from "defu";
29
27
  import { prettyBytes } from "@stryke/string-format/pretty-bytes";
30
- import { match, tsconfigPathsToRegExp } from "bundle-require";
31
- import { fileURLToPath } from "node:url";
28
+ import { createLog } from "@powerlines/core/lib/logger";
32
29
  import { getField } from "@stryke/helpers/get-field";
33
30
  import { readJsonFile } from "@stryke/fs/json";
34
31
  import "@stryke/fs/remove-file";
@@ -43,6 +40,7 @@ import { fetchRequest } from "@stryke/http/fetch";
43
40
  import { joinPaths as joinPaths$1 } from "@stryke/path/join";
44
41
  import { isNull } from "@stryke/type-checks/is-null";
45
42
  import { uuid } from "@stryke/unique-id/uuid";
43
+ import { match, tsconfigPathsToRegExp } from "bundle-require";
46
44
  import { resolveCompatibilityDates } from "compatx";
47
45
  import { create } from "flat-cache";
48
46
  import { parse } from "oxc-parser";
@@ -56,413 +54,8 @@ import { isAbsolutePath } from "@stryke/path/is-type";
56
54
  import { slash } from "@stryke/path/slash";
57
55
  import { isRegExp } from "@stryke/type-checks/is-regexp";
58
56
  import { Blob } from "node:buffer";
57
+ import { fileURLToPath } from "node:url";
59
58
 
60
- //#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
61
- const ANSI_BACKGROUND_OFFSET = 10;
62
- const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
63
- const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
64
- const wrapAnsi16m = (offset = 0) => (red, green, blue) => `\u001B[${38 + offset};2;${red};${green};${blue}m`;
65
- const styles$1 = {
66
- modifier: {
67
- reset: [0, 0],
68
- bold: [1, 22],
69
- dim: [2, 22],
70
- italic: [3, 23],
71
- underline: [4, 24],
72
- overline: [53, 55],
73
- inverse: [7, 27],
74
- hidden: [8, 28],
75
- strikethrough: [9, 29]
76
- },
77
- color: {
78
- black: [30, 39],
79
- red: [31, 39],
80
- green: [32, 39],
81
- yellow: [33, 39],
82
- blue: [34, 39],
83
- magenta: [35, 39],
84
- cyan: [36, 39],
85
- white: [37, 39],
86
- blackBright: [90, 39],
87
- gray: [90, 39],
88
- grey: [90, 39],
89
- redBright: [91, 39],
90
- greenBright: [92, 39],
91
- yellowBright: [93, 39],
92
- blueBright: [94, 39],
93
- magentaBright: [95, 39],
94
- cyanBright: [96, 39],
95
- whiteBright: [97, 39]
96
- },
97
- bgColor: {
98
- bgBlack: [40, 49],
99
- bgRed: [41, 49],
100
- bgGreen: [42, 49],
101
- bgYellow: [43, 49],
102
- bgBlue: [44, 49],
103
- bgMagenta: [45, 49],
104
- bgCyan: [46, 49],
105
- bgWhite: [47, 49],
106
- bgBlackBright: [100, 49],
107
- bgGray: [100, 49],
108
- bgGrey: [100, 49],
109
- bgRedBright: [101, 49],
110
- bgGreenBright: [102, 49],
111
- bgYellowBright: [103, 49],
112
- bgBlueBright: [104, 49],
113
- bgMagentaBright: [105, 49],
114
- bgCyanBright: [106, 49],
115
- bgWhiteBright: [107, 49]
116
- }
117
- };
118
- const modifierNames = Object.keys(styles$1.modifier);
119
- const foregroundColorNames = Object.keys(styles$1.color);
120
- const backgroundColorNames = Object.keys(styles$1.bgColor);
121
- const colorNames = [...foregroundColorNames, ...backgroundColorNames];
122
- function assembleStyles() {
123
- const codes = /* @__PURE__ */ new Map();
124
- for (const [groupName, group] of Object.entries(styles$1)) {
125
- for (const [styleName, style] of Object.entries(group)) {
126
- styles$1[styleName] = {
127
- open: `\u001B[${style[0]}m`,
128
- close: `\u001B[${style[1]}m`
129
- };
130
- group[styleName] = styles$1[styleName];
131
- codes.set(style[0], style[1]);
132
- }
133
- Object.defineProperty(styles$1, groupName, {
134
- value: group,
135
- enumerable: false
136
- });
137
- }
138
- Object.defineProperty(styles$1, "codes", {
139
- value: codes,
140
- enumerable: false
141
- });
142
- styles$1.color.close = "\x1B[39m";
143
- styles$1.bgColor.close = "\x1B[49m";
144
- styles$1.color.ansi = wrapAnsi16();
145
- styles$1.color.ansi256 = wrapAnsi256();
146
- styles$1.color.ansi16m = wrapAnsi16m();
147
- styles$1.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
148
- styles$1.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
149
- styles$1.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
150
- Object.defineProperties(styles$1, {
151
- rgbToAnsi256: {
152
- value(red, green, blue) {
153
- if (red === green && green === blue) {
154
- if (red < 8) return 16;
155
- if (red > 248) return 231;
156
- return Math.round((red - 8) / 247 * 24) + 232;
157
- }
158
- return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
159
- },
160
- enumerable: false
161
- },
162
- hexToRgb: {
163
- value(hex) {
164
- const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
165
- if (!matches) return [
166
- 0,
167
- 0,
168
- 0
169
- ];
170
- let [colorString] = matches;
171
- if (colorString.length === 3) colorString = [...colorString].map((character) => character + character).join("");
172
- const integer = Number.parseInt(colorString, 16);
173
- return [
174
- integer >> 16 & 255,
175
- integer >> 8 & 255,
176
- integer & 255
177
- ];
178
- },
179
- enumerable: false
180
- },
181
- hexToAnsi256: {
182
- value: (hex) => styles$1.rgbToAnsi256(...styles$1.hexToRgb(hex)),
183
- enumerable: false
184
- },
185
- ansi256ToAnsi: {
186
- value(code) {
187
- if (code < 8) return 30 + code;
188
- if (code < 16) return 90 + (code - 8);
189
- let red;
190
- let green;
191
- let blue;
192
- if (code >= 232) {
193
- red = ((code - 232) * 10 + 8) / 255;
194
- green = red;
195
- blue = red;
196
- } else {
197
- code -= 16;
198
- const remainder = code % 36;
199
- red = Math.floor(code / 36) / 5;
200
- green = Math.floor(remainder / 6) / 5;
201
- blue = remainder % 6 / 5;
202
- }
203
- const value = Math.max(red, green, blue) * 2;
204
- if (value === 0) return 30;
205
- let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
206
- if (value === 2) result += 60;
207
- return result;
208
- },
209
- enumerable: false
210
- },
211
- rgbToAnsi: {
212
- value: (red, green, blue) => styles$1.ansi256ToAnsi(styles$1.rgbToAnsi256(red, green, blue)),
213
- enumerable: false
214
- },
215
- hexToAnsi: {
216
- value: (hex) => styles$1.ansi256ToAnsi(styles$1.hexToAnsi256(hex)),
217
- enumerable: false
218
- }
219
- });
220
- return styles$1;
221
- }
222
- const ansiStyles = assembleStyles();
223
-
224
- //#endregion
225
- //#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
226
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
227
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
228
- const position = argv.indexOf(prefix + flag);
229
- const terminatorPosition = argv.indexOf("--");
230
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
231
- }
232
- const { env } = process;
233
- let flagForceColor;
234
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
235
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
236
- function envForceColor() {
237
- if ("FORCE_COLOR" in env) {
238
- if (env.FORCE_COLOR === "true") return 1;
239
- if (env.FORCE_COLOR === "false") return 0;
240
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
241
- }
242
- }
243
- function translateLevel(level) {
244
- if (level === 0) return false;
245
- return {
246
- level,
247
- hasBasic: true,
248
- has256: level >= 2,
249
- has16m: level >= 3
250
- };
251
- }
252
- function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
253
- const noFlagForceColor = envForceColor();
254
- if (noFlagForceColor !== void 0) flagForceColor = noFlagForceColor;
255
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
256
- if (forceColor === 0) return 0;
257
- if (sniffFlags) {
258
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
259
- if (hasFlag("color=256")) return 2;
260
- }
261
- if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
262
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
263
- const min = forceColor || 0;
264
- if (env.TERM === "dumb") return min;
265
- if (process.platform === "win32") {
266
- const osRelease = os.release().split(".");
267
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
268
- return 1;
269
- }
270
- if ("CI" in env) {
271
- if ([
272
- "GITHUB_ACTIONS",
273
- "GITEA_ACTIONS",
274
- "CIRCLECI"
275
- ].some((key) => key in env)) return 3;
276
- if ([
277
- "TRAVIS",
278
- "APPVEYOR",
279
- "GITLAB_CI",
280
- "BUILDKITE",
281
- "DRONE"
282
- ].some((sign) => sign in env) || env.CI_NAME === "codeship") return 1;
283
- return min;
284
- }
285
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
286
- if (env.COLORTERM === "truecolor") return 3;
287
- if (env.TERM === "xterm-kitty") return 3;
288
- if (env.TERM === "xterm-ghostty") return 3;
289
- if (env.TERM === "wezterm") return 3;
290
- if ("TERM_PROGRAM" in env) {
291
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
292
- switch (env.TERM_PROGRAM) {
293
- case "iTerm.app": return version >= 3 ? 3 : 2;
294
- case "Apple_Terminal": return 2;
295
- }
296
- }
297
- if (/-256(color)?$/i.test(env.TERM)) return 2;
298
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
299
- if ("COLORTERM" in env) return 1;
300
- return min;
301
- }
302
- function createSupportsColor(stream, options = {}) {
303
- return translateLevel(_supportsColor(stream, {
304
- streamIsTTY: stream && stream.isTTY,
305
- ...options
306
- }));
307
- }
308
- const supportsColor = {
309
- stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
310
- stderr: createSupportsColor({ isTTY: tty.isatty(2) })
311
- };
312
-
313
- //#endregion
314
- //#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
315
- function stringReplaceAll(string, substring, replacer) {
316
- let index = string.indexOf(substring);
317
- if (index === -1) return string;
318
- const substringLength = substring.length;
319
- let endIndex = 0;
320
- let returnValue = "";
321
- do {
322
- returnValue += string.slice(endIndex, index) + substring + replacer;
323
- endIndex = index + substringLength;
324
- index = string.indexOf(substring, endIndex);
325
- } while (index !== -1);
326
- returnValue += string.slice(endIndex);
327
- return returnValue;
328
- }
329
- function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
330
- let endIndex = 0;
331
- let returnValue = "";
332
- do {
333
- const gotCR = string[index - 1] === "\r";
334
- returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
335
- endIndex = index + 1;
336
- index = string.indexOf("\n", endIndex);
337
- } while (index !== -1);
338
- returnValue += string.slice(endIndex);
339
- return returnValue;
340
- }
341
-
342
- //#endregion
343
- //#region ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
344
- const { stdout: stdoutColor, stderr: stderrColor } = supportsColor;
345
- const GENERATOR = Symbol("GENERATOR");
346
- const STYLER = Symbol("STYLER");
347
- const IS_EMPTY = Symbol("IS_EMPTY");
348
- const levelMapping = [
349
- "ansi",
350
- "ansi",
351
- "ansi256",
352
- "ansi16m"
353
- ];
354
- const styles = Object.create(null);
355
- const applyOptions = (object, options = {}) => {
356
- if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) throw new Error("The `level` option should be an integer from 0 to 3");
357
- const colorLevel = stdoutColor ? stdoutColor.level : 0;
358
- object.level = options.level === void 0 ? colorLevel : options.level;
359
- };
360
- const chalkFactory = (options) => {
361
- const chalk = (...strings) => strings.join(" ");
362
- applyOptions(chalk, options);
363
- Object.setPrototypeOf(chalk, createChalk.prototype);
364
- return chalk;
365
- };
366
- function createChalk(options) {
367
- return chalkFactory(options);
368
- }
369
- Object.setPrototypeOf(createChalk.prototype, Function.prototype);
370
- for (const [styleName, style] of Object.entries(ansiStyles)) styles[styleName] = { get() {
371
- const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
372
- Object.defineProperty(this, styleName, { value: builder });
373
- return builder;
374
- } };
375
- styles.visible = { get() {
376
- const builder = createBuilder(this, this[STYLER], true);
377
- Object.defineProperty(this, "visible", { value: builder });
378
- return builder;
379
- } };
380
- const getModelAnsi = (model, level, type, ...arguments_) => {
381
- if (model === "rgb") {
382
- if (level === "ansi16m") return ansiStyles[type].ansi16m(...arguments_);
383
- if (level === "ansi256") return ansiStyles[type].ansi256(ansiStyles.rgbToAnsi256(...arguments_));
384
- return ansiStyles[type].ansi(ansiStyles.rgbToAnsi(...arguments_));
385
- }
386
- if (model === "hex") return getModelAnsi("rgb", level, type, ...ansiStyles.hexToRgb(...arguments_));
387
- return ansiStyles[type][model](...arguments_);
388
- };
389
- for (const model of [
390
- "rgb",
391
- "hex",
392
- "ansi256"
393
- ]) {
394
- styles[model] = { get() {
395
- const { level } = this;
396
- return function(...arguments_) {
397
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansiStyles.color.close, this[STYLER]);
398
- return createBuilder(this, styler, this[IS_EMPTY]);
399
- };
400
- } };
401
- const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
402
- styles[bgModel] = { get() {
403
- const { level } = this;
404
- return function(...arguments_) {
405
- const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansiStyles.bgColor.close, this[STYLER]);
406
- return createBuilder(this, styler, this[IS_EMPTY]);
407
- };
408
- } };
409
- }
410
- const proto = Object.defineProperties(() => {}, {
411
- ...styles,
412
- level: {
413
- enumerable: true,
414
- get() {
415
- return this[GENERATOR].level;
416
- },
417
- set(level) {
418
- this[GENERATOR].level = level;
419
- }
420
- }
421
- });
422
- const createStyler = (open, close, parent) => {
423
- let openAll;
424
- let closeAll;
425
- if (parent === void 0) {
426
- openAll = open;
427
- closeAll = close;
428
- } else {
429
- openAll = parent.openAll + open;
430
- closeAll = close + parent.closeAll;
431
- }
432
- return {
433
- open,
434
- close,
435
- openAll,
436
- closeAll,
437
- parent
438
- };
439
- };
440
- const createBuilder = (self, _styler, _isEmpty) => {
441
- const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
442
- Object.setPrototypeOf(builder, proto);
443
- builder[GENERATOR] = self;
444
- builder[STYLER] = _styler;
445
- builder[IS_EMPTY] = _isEmpty;
446
- return builder;
447
- };
448
- const applyStyle = (self, string) => {
449
- if (self.level <= 0 || !string) return self[IS_EMPTY] ? "" : string;
450
- let styler = self[STYLER];
451
- if (styler === void 0) return string;
452
- const { openAll, closeAll } = styler;
453
- if (string.includes("\x1B")) while (styler !== void 0) {
454
- string = stringReplaceAll(string, styler.close, styler.open);
455
- styler = styler.parent;
456
- }
457
- const lfIndex = string.indexOf("\n");
458
- if (lfIndex !== -1) string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
459
- return openAll + string + closeAll;
460
- };
461
- Object.defineProperties(createChalk.prototype, styles);
462
- const chalk = createChalk();
463
- const chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
464
-
465
- //#endregion
466
59
  //#region src/_internal/helpers/hooks.ts
467
60
  const mergeResultObjects = createDefu((obj, key, value) => {
468
61
  if (isString(obj[key]) && isString(value)) {
@@ -508,7 +101,7 @@ function mergeConfigs(currentResult, previousResults) {
508
101
  async function callHook(context, key, options, ...args) {
509
102
  const hooks = context.selectHooks(key, options);
510
103
  if (hooks.length > 0) {
511
- context.debug(` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
104
+ context.debug(` 🧩 Calling ${hooks.length} ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => ` ${index + 1}. ${(0, utils_exports.colorText)(hook.plugin.name)}`).join("\n")}`);
512
105
  const invokeHook = async (hook, hookArgs) => {
513
106
  return Reflect.apply(hook.handler, hook.context, hookArgs);
514
107
  };
@@ -555,21 +148,42 @@ function extractHooks(context, hooks, plugin, key, parentKey) {
555
148
  if (plugin.enforce) {
556
149
  const hookListOrder = `${plugin.enforce}Enforced`;
557
150
  hooks[combinedKey][hookListOrder] ??= [];
558
- const bucket = hooks[combinedKey][hookListOrder];
559
- (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, bucket);
151
+ hooks[combinedKey][hookListOrder] = (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);
560
152
  return hooks;
561
153
  }
562
154
  if (isFunction(pluginHook) || !pluginHook.order) {
563
155
  hooks[combinedKey].normal ??= [];
564
- const bucket = hooks[combinedKey].normal;
565
- (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, bucket);
156
+ hooks[combinedKey].normal = (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, hooks[combinedKey].normal);
566
157
  return hooks;
567
158
  }
568
159
  const hookListOrder = `${pluginHook.order}Ordered`;
569
160
  hooks[combinedKey][hookListOrder] ??= [];
570
- (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);
161
+ hooks[combinedKey][hookListOrder] = (0, plugin_utils_exports.addPluginHook)(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);
571
162
  return hooks;
572
- } else if (isSetObject(pluginField)) return Object.keys(pluginField).map((pluginKey) => extractHooks(context, hooks, plugin, pluginKey, combinedKey)).reduce((ret, current) => defu(ret, current), hooks);
163
+ } else if (isSetObject(pluginField)) return Object.keys(pluginField).map((pluginKey) => extractHooks(context, hooks, plugin, pluginKey, combinedKey)).reduce((ret, current) => {
164
+ Object.keys(current).forEach((key) => {
165
+ ret[key] ??= {
166
+ preEnforced: [],
167
+ preOrdered: [],
168
+ normal: [],
169
+ postEnforced: [],
170
+ postOrdered: []
171
+ };
172
+ [
173
+ "preEnforced",
174
+ "preOrdered",
175
+ "normal",
176
+ "postEnforced",
177
+ "postOrdered"
178
+ ].forEach((order) => {
179
+ if (current[key]?.[order]) {
180
+ ret[key][order] ??= [];
181
+ ret[key][order] = ret[key][order].concat(current[key][order]);
182
+ }
183
+ });
184
+ });
185
+ return ret;
186
+ }, hooks);
573
187
  return hooks;
574
188
  }
575
189
 
@@ -2732,7 +2346,8 @@ var PowerlinesContext = class PowerlinesContext {
2732
2346
  createLog(name = null) {
2733
2347
  return (0, utils_exports.createLog)(name, {
2734
2348
  ...this.config,
2735
- logLevel: isNull(this.config.logLevel) ? "silent" : this.config.logLevel
2349
+ logLevel: isNull(this.config.logLevel) ? "silent" : this.config.logLevel,
2350
+ command: this.config.command
2736
2351
  });
2737
2352
  }
2738
2353
  /**
@@ -2922,7 +2537,7 @@ var PowerlinesContext = class PowerlinesContext {
2922
2537
  };
2923
2538
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
2924
2539
  this.config.plugins = (this.config.plugins ?? []).filter(Boolean).reduce((ret, plugin) => {
2925
- if ((0, plugin_utils_exports.isPlugin)(plugin) && (0, plugin_utils_exports.checkDedupe)(plugin, ret.filter((p) => (0, plugin_utils_exports.isPlugin)(p)))) return ret;
2540
+ if ((0, plugin_utils_exports.isPlugin)(plugin) && (0, plugin_utils_exports.isDuplicate)(plugin, ret.filter((p) => (0, plugin_utils_exports.isPlugin)(p)))) return ret;
2926
2541
  ret.push(plugin);
2927
2542
  return ret;
2928
2543
  }, []);
@@ -2943,7 +2558,7 @@ var PowerlinesContext = class PowerlinesContext {
2943
2558
  this.config.userConfig = (0, plugin_utils_exports.mergeConfig)(from, into);
2944
2559
  if (this.config.userConfig.output?.format) this.config.userConfig.output.format = getUnique(toArray(this.config.userConfig.output?.format));
2945
2560
  this.config.userConfig.plugins = (this.config.userConfig.plugins ?? []).filter(Boolean).reduce((ret, plugin) => {
2946
- if ((0, plugin_utils_exports.isPlugin)(plugin) && (0, plugin_utils_exports.checkDedupe)(plugin, ret.filter((p) => (0, plugin_utils_exports.isPlugin)(p)))) return ret;
2561
+ if ((0, plugin_utils_exports.isPlugin)(plugin) && (0, plugin_utils_exports.isDuplicate)(plugin, ret.filter((p) => (0, plugin_utils_exports.isPlugin)(p)))) return ret;
2947
2562
  ret.push(plugin);
2948
2563
  return ret;
2949
2564
  }, []);
@@ -3061,6 +2676,22 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3061
2676
  get config() {
3062
2677
  return super.config;
3063
2678
  }
2679
+ /**
2680
+ * Create a new logger instance
2681
+ *
2682
+ * @param name - The name to use for the logger instance
2683
+ * @returns A logger function
2684
+ */
2685
+ createLog(name = null) {
2686
+ return createLog(name, {
2687
+ ...this.config,
2688
+ logLevel: isNull(this.config.logLevel) ? "silent" : this.config.logLevel,
2689
+ environment: this.environment?.name
2690
+ });
2691
+ }
2692
+ /**
2693
+ * The hooks registered by plugins in this environment
2694
+ */
3064
2695
  get hooks() {
3065
2696
  return this.#hooks;
3066
2697
  }
@@ -3098,8 +2729,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3098
2729
  selectHooks(key, options) {
3099
2730
  const result = [];
3100
2731
  if ((0, plugin_utils_exports.isPluginHookField)(key) && this.hooks[key]) {
3101
- const hooks = this.hooks[key];
3102
- if (hooks) if (options?.order) {
2732
+ if (this.hooks[key]) if (options?.order) {
3103
2733
  const mapHooksToResult = (hooksList) => hooksList.map((hook) => {
3104
2734
  const plugin = this.plugins.find((p) => p.plugin.name === hook.plugin.name);
3105
2735
  if (!plugin) throw new Error(`Could not find plugin context for plugin "${hook.plugin.name}".`);
@@ -3110,12 +2740,12 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3110
2740
  };
3111
2741
  });
3112
2742
  if (options?.order === "pre") {
3113
- result.push(...mapHooksToResult(hooks.preOrdered ?? []));
3114
- result.push(...mapHooksToResult(hooks.preEnforced ?? []));
2743
+ result.push(...mapHooksToResult(this.hooks[key].preOrdered ?? []));
2744
+ result.push(...mapHooksToResult(this.hooks[key].preEnforced ?? []));
3115
2745
  } else if (options?.order === "post") {
3116
- result.push(...mapHooksToResult(hooks.postOrdered ?? []));
3117
- result.push(...mapHooksToResult(hooks.postEnforced ?? []));
3118
- } else result.push(...mapHooksToResult(hooks.normal ?? []));
2746
+ result.push(...mapHooksToResult(this.hooks[key].postOrdered ?? []));
2747
+ result.push(...mapHooksToResult(this.hooks[key].postEnforced ?? []));
2748
+ } else result.push(...mapHooksToResult(this.hooks[key].normal ?? []));
3119
2749
  } else {
3120
2750
  result.push(...this.selectHooks(key, { order: "pre" }));
3121
2751
  result.push(...this.selectHooks(key, { order: "normal" }));
@@ -3322,5 +2952,5 @@ var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext
3322
2952
  };
3323
2953
 
3324
2954
  //#endregion
3325
- export { FileId as a, FileStorage as c, writeMetaFile as d, callHook as f, PowerlinesContext as i, FileSystem as l, chalk as m, PowerlinesEnvironmentContext as n, FileMetadata as o, mergeConfigs as p, createPluginContext as r, FileMetadata_KeyValuePair as s, PowerlinesAPIContext as t, _capnpFileId as u };
3326
- //# sourceMappingURL=api-context-BQi9M07D.mjs.map
2955
+ export { FileId as a, FileStorage as c, writeMetaFile as d, callHook as f, PowerlinesContext as i, FileSystem as l, PowerlinesEnvironmentContext as n, FileMetadata as o, mergeConfigs as p, createPluginContext as r, FileMetadata_KeyValuePair as s, PowerlinesAPIContext as t, _capnpFileId as u };
2956
+ //# sourceMappingURL=api-context-CmuOyg7q.mjs.map