@rzl-zone/build-tools 0.0.10 → 0.0.12-beta.0

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 (80) hide show
  1. package/dist/.references/index.d.cts +1 -1
  2. package/dist/.references/index.d.ts +1 -1
  3. package/dist/bundler/rolldown.cjs +4 -4
  4. package/dist/bundler/rolldown.cjs.map +1 -1
  5. package/dist/bundler/rolldown.d.cts +2 -2
  6. package/dist/bundler/rolldown.d.ts +2 -2
  7. package/dist/bundler/rolldown.js +1 -1
  8. package/dist/bundler/rolldown.js.map +1 -1
  9. package/dist/bundler/tsdown.cjs +9 -9
  10. package/dist/bundler/tsdown.cjs.map +1 -1
  11. package/dist/bundler/tsdown.d.cts +2 -2
  12. package/dist/bundler/tsdown.d.ts +2 -2
  13. package/dist/bundler/tsdown.js +3 -3
  14. package/dist/bundler/tsdown.js.map +1 -1
  15. package/dist/bundler/utils.cjs +2 -2
  16. package/dist/bundler/utils.cjs.map +1 -1
  17. package/dist/bundler/utils.d.cts +2 -2
  18. package/dist/bundler/utils.d.ts +2 -2
  19. package/dist/bundler/utils.js +2 -2
  20. package/dist/bundler/utils.js.map +1 -1
  21. package/dist/client-E8kISMNO.cjs +81 -0
  22. package/dist/client-E8kISMNO.cjs.map +1 -0
  23. package/dist/client-MFOxk6MV.js +75 -0
  24. package/dist/client-MFOxk6MV.js.map +1 -0
  25. package/dist/commander-kit/index.cjs +84 -65
  26. package/dist/commander-kit/index.cjs.map +1 -1
  27. package/dist/commander-kit/index.d.cts +3 -3
  28. package/dist/commander-kit/index.d.ts +3 -3
  29. package/dist/commander-kit/index.js +24 -5
  30. package/dist/commander-kit/index.js.map +1 -1
  31. package/dist/{extra-CYpD3D9p.d.ts → extra-B1CzOGop.d.ts} +2 -2
  32. package/dist/{extra-Dc_eIyiW.d.cts → extra-DJwL1pB2.d.cts} +2 -2
  33. package/dist/{fast-globe-options-CZ-9wIKV.d.ts → fast-globe-options-DDloBj5e.d.ts} +3 -3
  34. package/dist/{fast-globe-options-BtIrCNb6.d.cts → fast-globe-options-Rz3TI5hc.d.cts} +3 -3
  35. package/dist/{helper-CWU8QYq3.js → formatter-BS3omf7k.js} +88 -3
  36. package/dist/formatter-BS3omf7k.js.map +1 -0
  37. package/dist/{helper-DvCvgDxy.cjs → formatter-Cbz6g0Mi.cjs} +142 -14
  38. package/dist/formatter-Cbz6g0Mi.cjs.map +1 -0
  39. package/dist/{identity-xuDCNgfm.js → identity-Cznri5bj.js} +5 -6
  40. package/dist/{identity-xuDCNgfm.js.map → identity-Cznri5bj.js.map} +1 -1
  41. package/dist/{identity-D192lL-_.cjs → identity-D2BhaOq4.cjs} +14 -15
  42. package/dist/{identity-D192lL-_.cjs.map → identity-D2BhaOq4.cjs.map} +1 -1
  43. package/dist/{index-1FKLQ7ah.d.cts → index-BW05_5Zw.d.ts} +2 -2
  44. package/dist/{index-qft-a5kh.d.ts → index-C5uH9Zib.d.cts} +2 -2
  45. package/dist/{index-CEsO_rxz.d.ts → index-D5tuL_Tf.d.cts} +2 -2
  46. package/dist/{index-DW1JFluR.d.cts → index-DMYmm0in.d.ts} +2 -2
  47. package/dist/index.cjs +378 -359
  48. package/dist/index.cjs.map +1 -1
  49. package/dist/index.d.cts +81 -48
  50. package/dist/index.d.ts +81 -48
  51. package/dist/index.js +175 -156
  52. package/dist/index.js.map +1 -1
  53. package/dist/package-banner-Com8U-Xm.cjs +59 -0
  54. package/dist/{package-banner-BHyF8RdG.cjs.map → package-banner-Com8U-Xm.cjs.map} +1 -1
  55. package/dist/{package-banner-BmLNyezO.js → package-banner-Jw1DuF8v.js} +4 -5
  56. package/dist/{package-banner-BmLNyezO.js.map → package-banner-Jw1DuF8v.js.map} +1 -1
  57. package/dist/server-Bewzn3sy.cjs +255 -0
  58. package/dist/server-Bewzn3sy.cjs.map +1 -0
  59. package/dist/server-Owi9-DW1.js +198 -0
  60. package/dist/server-Owi9-DW1.js.map +1 -0
  61. package/dist/utils/client.cjs +12 -11
  62. package/dist/utils/client.d.cts +1 -1
  63. package/dist/utils/client.d.ts +1 -1
  64. package/dist/utils/client.js +3 -2
  65. package/dist/utils/server.cjs +5 -2
  66. package/dist/utils/server.d.cts +433 -3
  67. package/dist/utils/server.d.ts +433 -3
  68. package/dist/utils/server.js +3 -3
  69. package/package.json +10 -6
  70. package/dist/client-BmfdVI22.js +0 -160
  71. package/dist/client-BmfdVI22.js.map +0 -1
  72. package/dist/client-DnTjQyyo.cjs +0 -221
  73. package/dist/client-DnTjQyyo.cjs.map +0 -1
  74. package/dist/helper-CWU8QYq3.js.map +0 -1
  75. package/dist/helper-DvCvgDxy.cjs.map +0 -1
  76. package/dist/package-banner-BHyF8RdG.cjs +0 -60
  77. package/dist/server-BA7ruG1h.js +0 -142
  78. package/dist/server-BA7ruG1h.js.map +0 -1
  79. package/dist/server-DZvrqlyy.cjs +0 -181
  80. package/dist/server-DZvrqlyy.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.10`
5
+ * Version: `0.0.12-beta.0`
6
6
  * Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
7
7
  * Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
8
8
  * ========================================================================
@@ -10,22 +10,22 @@
10
10
 
11
11
  "use strict";
12
12
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
13
- const require_helper = require('./helper-DvCvgDxy.cjs');
14
- const require_server = require('./server-DZvrqlyy.cjs');
15
- const require_identity = require('./identity-D192lL-_.cjs');
16
- const require_client = require('./client-DnTjQyyo.cjs');
17
- const require_package_banner = require('./package-banner-BHyF8RdG.cjs');
13
+ const require_formatter = require('./formatter-Cbz6g0Mi.cjs');
14
+ const require_server = require('./server-Bewzn3sy.cjs');
15
+ const require_identity = require('./identity-D2BhaOq4.cjs');
16
+ const require_package_banner = require('./package-banner-Com8U-Xm.cjs');
18
17
  require("@rzl-zone/node-only");
19
18
  let _babel_types = require("@babel/types");
20
- _babel_types = require_helper.__toESM(_babel_types, 1);
19
+ _babel_types = require_formatter.__toESM(_babel_types, 1);
21
20
  let _babel_parser = require("@babel/parser");
22
21
  let _babel_traverse = require("@babel/traverse");
23
- _babel_traverse = require_helper.__toESM(_babel_traverse, 1);
22
+ _babel_traverse = require_formatter.__toESM(_babel_traverse, 1);
24
23
  let node_path = require("node:path");
25
- node_path = require_helper.__toESM(node_path, 1);
24
+ node_path = require_formatter.__toESM(node_path, 1);
25
+ let shell_quote = require("shell-quote");
26
26
  let node_child_process = require("node:child_process");
27
27
  let acorn = require("acorn");
28
- acorn = require_helper.__toESM(acorn, 1);
28
+ acorn = require_formatter.__toESM(acorn, 1);
29
29
  function isLogLevel(value) {
30
30
  return typeof value === "string" && value in LOG_LEVEL_PRIORITY;
31
31
  }
@@ -45,7 +45,7 @@ function resolveLogVerbosity(options, fallback = DEFAULT_LOG_LEVEL) {
45
45
  function canLog(current, target, fallbackIfInvalid = DEFAULT_LOG_LEVEL) {
46
46
  const fallbackLog = isLogLevel(fallbackIfInvalid) ? fallbackIfInvalid : DEFAULT_LOG_LEVEL;
47
47
  const resolvedCurrent = isLogLevel(current) ? current : fallbackLog;
48
- return (require_helper.isString(target) ? [target] : require_helper.isArray(target) ? target : [fallbackLog]).some((level) => LOG_LEVEL_PRIORITY[resolvedCurrent] >= LOG_LEVEL_PRIORITY[level]);
48
+ return (require_formatter.isString(target) ? [target] : require_formatter.isArray(target) ? target : [fallbackLog]).some((level) => LOG_LEVEL_PRIORITY[resolvedCurrent] >= LOG_LEVEL_PRIORITY[level]);
49
49
  }
50
50
  const DEFAULT_CLEAN_PATTERN_POLICY = {
51
51
  filesOnly: true,
@@ -82,14 +82,14 @@ const NON_COMMENTABLE_FILE_RE = /(?:^|[\\/])(?:package-lock\.json|composer\.lock
82
82
  function hasExecutableCode(content) {
83
83
  const { body } = extractAndHoistBanner(content.trim());
84
84
  const { rest } = extractDirectives(body);
85
- return require_helper.isNonEmptyString(rest);
85
+ return require_formatter.isNonEmptyString(rest);
86
86
  }
87
87
  const defaultCommentOptions = {
88
88
  removeRegion: true,
89
89
  removeSourceMap: false
90
90
  };
91
91
  const isTargetComment = (line, options = defaultCommentOptions) => {
92
- if (!require_helper.isNonEmptyString(line)) return false;
92
+ if (!require_formatter.isNonEmptyString(line)) return false;
93
93
  if (SOURCE_PATH_RE.test(line)) return true;
94
94
  if (ESLINT_RE.test(line)) return true;
95
95
  if (options.removeRegion && REGION_RE.test(line)) return true;
@@ -192,58 +192,6 @@ function stripUseStrict(content, { trimStart = true, trimEnd = false } = {}) {
192
192
  if (trimEnd) result.trimEnd();
193
193
  return result;
194
194
  }
195
- const sourceOf = (value, defaultValue) => {
196
- return Object.is(value, defaultValue) ? "default" : "overridden";
197
- };
198
- const BUILD_LOGGER = {
199
- SOURCE_OF: sourceOf,
200
- OPTIONS(label, value, source, isRequired) {
201
- const sourceLabel = !isRequired && source ? source === "default" ? require_client.picocolors.blueBright(` (${source})`) : require_client.picocolors.yellowBright(` (${source})`) : "";
202
- console.log(require_client.picocolors.dim(" - ") + require_helper.normalizeSpaces(require_client.picocolors.bold(label || "`⚠️ Label Unset!!!`") + require_client.picocolors.dim(": ") + require_client.formatOptionValue(value) + require_client.picocolors.italic(sourceLabel)));
203
- },
204
- SECTION(title, options = {}) {
205
- const { icon = require_server.ICONS.config, indent = "" } = options;
206
- console.log(require_client.picocolors.bold(`${indent}${require_client.picocolors.whiteBright(icon)} ${require_client.picocolors.underline(require_client.picocolors.cyanBright(title || "`⚠️ Unset Title!!!`"))}:`));
207
- },
208
- NEW_LINE(value = "") {
209
- return console.log(value);
210
- },
211
- ON_STARTING: (options) => {
212
- const { actionName, textDirectAction = "to" } = options;
213
- console.log(require_client.picocolors.bold(`${require_client.picocolors.whiteBright(require_server.ICONS.start)} ${require_client.picocolors.cyanBright("Starting")} ${require_helper.normalizeSpaces(`${textDirectAction} ${require_client.picocolors.underline(require_client.picocolors.blueBright(actionName))}`)}.`));
214
- },
215
- ON_FINISH: (options) => {
216
- const { actionName, count, typeCount = "file", progress, textSuccess = "Success" } = options;
217
- console.log(require_client.picocolors.bold(`${require_client.picocolors.greenBright(require_server.ICONS.success)} ${require_client.picocolors.greenBright(textSuccess)} ${require_helper.normalizeSpaces(`${require_client.picocolors.underline(require_client.picocolors.blueBright(actionName))} (${require_client.picocolors.yellowBright(`${require_helper.isNonEmptyString(progress) ? progress : count} ${typeCount}${count > 1 ? "(s)" : ""}`)}`)}).`));
218
- },
219
- ON_SKIPPING: (options) => {
220
- const { actionName, reasonEndText, reasonSkipAction = "nothing left", reasonTitle = "because", reasonType = "files", textDirectAction = "to" } = options;
221
- console.log(require_client.picocolors.bold(`${require_client.picocolors.yellowBright(require_server.ICONS.warn)} ${require_client.picocolors.yellowBright("Skipping")} ${require_helper.normalizeSpaces(`${require_client.picocolors.underline(require_client.picocolors.blueBright(actionName))} ${require_client.picocolors.white(reasonTitle)} ${require_client.picocolors.redBright(reasonSkipAction)} ${reasonType} ${textDirectAction} ${require_client.picocolors.redBright(reasonEndText)}`)}.`));
222
- },
223
- ON_ERROR: (options) => {
224
- const { actionName, textDirectAction = "to", error } = options;
225
- const errorMsg = require_helper.isError(error) ? error.message : "Something went wrong";
226
- console.error(require_client.picocolors.bold(`${require_client.picocolors.redBright(require_server.ICONS.error)} ${require_client.picocolors.redBright("Error")} ${require_helper.normalizeSpaces(`${textDirectAction} ${require_client.picocolors.underline(require_client.picocolors.blueBright(actionName))},`)} ${require_client.joinLines("because: ", "", ` ${require_client.picocolors.bold(require_client.picocolors.red(require_server.ICONS.arrowRight))} ${require_client.picocolors.inverse(require_client.picocolors.red(require_helper.normalizeSpaces(errorMsg)))}`)}`));
227
- },
228
- ON_PROCESS: (options) => {
229
- const { actionName, count, nameDirect, textDirectFolder = "in" } = options;
230
- console.log(`${require_client.picocolors.bold(" " + require_client.picocolors.whiteBright(require_server.ICONS.bullet))} ${require_client.picocolors.italic(`${require_client.picocolors.white(count + ".")} ${require_helper.normalizeSpaces(`${require_client.picocolors.white(actionName)} ${require_client.picocolors.magentaBright(textDirectFolder)} ${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.blue(nameDirect)))}.`)}`)}`);
231
- },
232
- ON_PROCESS_COPY: (options) => {
233
- const { actionName, count, copyTo, copyFrom, textFrom = "from", textArrow = "➔" } = options;
234
- console.log(`${require_client.picocolors.bold(" " + require_client.picocolors.whiteBright(require_server.ICONS.bullet))} ${require_client.picocolors.italic(`${require_client.picocolors.white(count + ".")} ${require_helper.normalizeSpaces(`${require_client.picocolors.white(actionName)} ${require_client.picocolors.yellow(textFrom)} '${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.cyanBright(copyFrom)))}' ${require_client.picocolors.bold(require_client.picocolors.gray(textArrow))} '${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.cyanBright(copyTo)))}'.`)}`)}`);
235
- },
236
- ON_PROCESS_COPY_ERROR: (options) => {
237
- const { actionName, count, errorReason, copyFrom, index, indexKey, textFrom = "from", textReason = "because" } = options;
238
- const errorReasonText = require_helper.isError(errorReason) ? errorReason.message : String(errorReason);
239
- const atIndexText = require_helper.isNumber(index) ? require_client.picocolors.blueBright(` (at${require_helper.isNonEmptyString(indexKey) ? ` '${indexKey}' ` : " "}index: ${require_client.picocolors.magentaBright(index)}) `) : " ";
240
- console.log(`${require_client.picocolors.bold(" " + require_client.picocolors.whiteBright(require_server.ICONS.bullet))} ${require_client.picocolors.italic(`${require_client.picocolors.white(count + ".")} ${require_helper.normalizeSpaces(`${require_client.picocolors.redBright(actionName)} ${require_client.picocolors.yellow(textFrom)} '${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.cyanBright(copyFrom)))}'${atIndexText}${require_client.picocolors.bold(require_client.picocolors.gray(textReason))} ${require_client.picocolors.redBright(errorReasonText)}.`)}`)}`);
241
- },
242
- ON_PROCESS_REFERENCING: (options) => {
243
- const { actionName, count, referenceTo, referenceFrom, textFrom = "from", textArrow = "➔" } = options;
244
- console.log(`${require_client.picocolors.bold(" " + require_client.picocolors.whiteBright(require_server.ICONS.bullet))} ${require_client.picocolors.italic(`${require_client.picocolors.white(count + ".")} ${require_helper.normalizeSpaces(`${require_client.picocolors.white(actionName)} ${require_client.picocolors.magentaBright(textFrom)} ${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.cyanBright(referenceFrom)))} ${require_client.picocolors.bold(require_client.picocolors.gray(textArrow))} ${require_client.picocolors.bold(require_client.picocolors.underline(require_client.picocolors.blueBright(referenceTo)))}.`)}`)}`);
245
- }
246
- };
247
195
  function stripLineArtifacts(line, options) {
248
196
  let out = line.replace(/^[ \t]*\/\/\s*(?:\.\.\/|\.\/)*[^ \n]*?(?:src|node_modules)\/[^\n]*\n?/gm, "").replace(/\/\/\s*eslint[^\n]*/g, "");
249
197
  if (options.removeSourceMap) out = out.replace(/^[ \t]*\/\/[#@]\s*sourceMappingURL\s*=\s*\S+/gm, "");
@@ -277,27 +225,27 @@ function cleanBuildArtifactsCore(lines, options) {
277
225
  }).map((line) => stripLineArtifacts(line, options));
278
226
  }
279
227
  async function runCleanBuildArtifacts({ patterns: pattern, options, fileTest, logAction }) {
280
- if (!require_helper.isPlainObject(options)) options = DEFAULT_CLEAN_OPTION;
228
+ if (!require_formatter.isPlainObject(options)) options = DEFAULT_CLEAN_OPTION;
281
229
  else options = {
282
230
  ...DEFAULT_CLEAN_OPTION,
283
231
  ...options
284
232
  };
285
233
  const { patternOptions, logLevel: loggerLevel, removeAdjacentEmptyLines, removeRegion, removeSourceMap } = options;
286
234
  try {
287
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(logAction.title, ""));
288
- const patterns = [...require_helper.toStringSet(pattern)];
235
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(logAction.title, ""));
236
+ const patterns = [...require_formatter.toStringSet(pattern)];
289
237
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_CLEAN_PATTERN_POLICY);
290
238
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
291
239
  if (canLog(loggerLevel, VERBOSE_LOG)) {
292
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
293
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
294
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_CLEAN_OPTION.patternOptions));
295
- BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_CLEAN_OPTION.removeSourceMap));
296
- BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_CLEAN_OPTION.removeRegion));
297
- BUILD_LOGGER.OPTIONS("options.removeAdjacentEmptyLines", removeAdjacentEmptyLines, BUILD_LOGGER.SOURCE_OF(removeAdjacentEmptyLines, DEFAULT_CLEAN_OPTION.removeAdjacentEmptyLines));
298
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_CLEAN_OPTION.logLevel));
299
- BUILD_LOGGER.NEW_LINE();
300
- BUILD_LOGGER.ON_STARTING({
240
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
241
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
242
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_CLEAN_OPTION.patternOptions));
243
+ require_server.BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, require_server.BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_CLEAN_OPTION.removeSourceMap));
244
+ require_server.BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, require_server.BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_CLEAN_OPTION.removeRegion));
245
+ require_server.BUILD_LOGGER.OPTIONS("options.removeAdjacentEmptyLines", removeAdjacentEmptyLines, require_server.BUILD_LOGGER.SOURCE_OF(removeAdjacentEmptyLines, DEFAULT_CLEAN_OPTION.removeAdjacentEmptyLines));
246
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_CLEAN_OPTION.logLevel));
247
+ require_server.BUILD_LOGGER.NEW_LINE();
248
+ require_server.BUILD_LOGGER.ON_STARTING({
301
249
  ...logAction.onStart,
302
250
  actionName: logAction.actionName
303
251
  });
@@ -314,7 +262,7 @@ async function runCleanBuildArtifacts({ patterns: pattern, options, fileTest, lo
314
262
  }
315
263
  const lines = splitLines(content);
316
264
  if (!fileHasTarget(lines, options)) continue;
317
- const finalContent = cleanBuildArtifactsCore(lines, options).join(require_client.EOL);
265
+ const finalContent = cleanBuildArtifactsCore(lines, options).join(require_formatter.EOL);
318
266
  if (finalContent === content) continue;
319
267
  count++;
320
268
  try {
@@ -323,24 +271,24 @@ async function runCleanBuildArtifacts({ patterns: pattern, options, fileTest, lo
323
271
  if (err.code === "ENOENT") continue;
324
272
  throw err;
325
273
  }
326
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
274
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
327
275
  ...logAction.onProcess,
328
276
  actionName: logAction.actionName,
329
277
  count,
330
278
  nameDirect: filePath
331
279
  });
332
280
  }
333
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
281
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
334
282
  actionName: logAction.actionName,
335
283
  count
336
284
  });
337
- else BUILD_LOGGER.ON_SKIPPING({
285
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
338
286
  ...logAction.onSkipping,
339
287
  actionName: logAction.actionName,
340
288
  reasonEndText: logAction.onSkipping?.reasonEndText ?? "cleaning"
341
289
  });
342
290
  } catch (error) {
343
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
291
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
344
292
  ...logAction.onError,
345
293
  actionName: logAction.actionName,
346
294
  error
@@ -359,7 +307,7 @@ const cleanJsBuildArtifacts = async (pattern, options = {}) => {
359
307
  fileTest: JS_OUTPUT_FILE_RE,
360
308
  logAction: {
361
309
  actionName: "Cleaning JS Build Artifacts",
362
- title: require_helper.isNonEmptyString(options.__commandTitle) ? options.__commandTitle : commandCjbaIdentity.utility()
310
+ title: require_formatter.isNonEmptyString(options.__commandTitle) ? options.__commandTitle : commandCjbaIdentity.utility()
363
311
  }
364
312
  });
365
313
  };
@@ -375,7 +323,7 @@ const cleanTypesBuildArtifacts = async (pattern, options = {}) => {
375
323
  fileTest: TS_DECLARATION_FILE_RE,
376
324
  logAction: {
377
325
  actionName: "Cleaning Types Build Artifacts",
378
- title: require_helper.isNonEmptyString(options.__commandTitle) ? options.__commandTitle : commandCtbaIdentity.utility()
326
+ title: require_formatter.isNonEmptyString(options.__commandTitle) ? options.__commandTitle : commandCtbaIdentity.utility()
379
327
  }
380
328
  });
381
329
  };
@@ -386,17 +334,17 @@ const DEFAULT_CFTD_OPTIONS = {
386
334
  ignoreMissingSourceError: false
387
335
  };
388
336
  const validateItem = (item, index) => {
389
- const indexText = require_helper.isNumber(index) ? ` at index ${index}` : "";
390
- if (!require_helper.isPlainObject(item)) throw new TypeError(`Invalid item${indexText}: must be a 'plain object'!`);
391
- if (!require_helper.isNonEmptyString(item.source) && !require_helper.isNonEmptyString(item.target)) throw new TypeError(`Invalid item${indexText}: 'source' and 'target' must be 'non-empty string'!`);
392
- if (!require_helper.isNonEmptyString(item.source)) throw new TypeError(`Invalid item${indexText}: 'source' must be 'non-empty string'!`);
393
- if (!require_helper.isNonEmptyString(item.target)) throw new TypeError(`Invalid item${indexText}: 'target' must be 'non-empty string'!`);
394
- if (!require_helper.isUndefined(item.fileName) && !require_helper.isNonEmptyString(item.fileName)) throw new TypeError(`Invalid item${indexText}: 'fileName' must be 'non-empty string' if provided!`);
395
- if (!require_helper.isUndefined(item.outputRoot) && !require_helper.isNonEmptyString(item.outputRoot)) throw new TypeError(`Invalid item${indexText}: 'outputRoot' must be 'non-empty string' if provided!`);
396
- if (!require_helper.isUndefined(item.absoluteTarget) && !require_helper.isBoolean(item.absoluteTarget)) throw new TypeError(`Invalid item${indexText}: 'absoluteTarget' must be a 'boolean' if provided!`);
337
+ const indexText = require_formatter.isNumber(index) ? ` at index ${index}` : "";
338
+ if (!require_formatter.isPlainObject(item)) throw new TypeError(`Invalid item${indexText}: must be a 'plain object'!`);
339
+ if (!require_formatter.isNonEmptyString(item.source) && !require_formatter.isNonEmptyString(item.target)) throw new TypeError(`Invalid item${indexText}: 'source' and 'target' must be 'non-empty string'!`);
340
+ if (!require_formatter.isNonEmptyString(item.source)) throw new TypeError(`Invalid item${indexText}: 'source' must be 'non-empty string'!`);
341
+ if (!require_formatter.isNonEmptyString(item.target)) throw new TypeError(`Invalid item${indexText}: 'target' must be 'non-empty string'!`);
342
+ if (!require_formatter.isUndefined(item.fileName) && !require_formatter.isNonEmptyString(item.fileName)) throw new TypeError(`Invalid item${indexText}: 'fileName' must be 'non-empty string' if provided!`);
343
+ if (!require_formatter.isUndefined(item.outputRoot) && !require_formatter.isNonEmptyString(item.outputRoot)) throw new TypeError(`Invalid item${indexText}: 'outputRoot' must be 'non-empty string' if provided!`);
344
+ if (!require_formatter.isUndefined(item.absoluteTarget) && !require_formatter.isBoolean(item.absoluteTarget)) throw new TypeError(`Invalid item${indexText}: 'absoluteTarget' must be a 'boolean' if provided!`);
397
345
  };
398
346
  function buildCopySummary(successCount, errorCount, duplicateCount, label) {
399
- return require_client.picocolors.bold(require_client.joinLinesLoose(require_client.joinInline(require_client.picocolors.yellowBright("⚠"), require_client.picocolors.blueBright(label) + require_client.picocolors.gray(" -"), require_client.picocolors.whiteBright(successCount > 0 ? "Some" : "All"), require_client.picocolors.whiteBright("files"), require_client.picocolors.redBright("failed to copy") + ":"), successCount < 1 ? false : ` ${require_client.picocolors.greenBright("✔")} ${require_client.picocolors.greenBright(successCount)} ${require_client.plural(successCount, "file")} copied.`, errorCount < 1 ? false : ` ${require_client.picocolors.redBright("✖")} ${require_client.picocolors.redBright(errorCount)} ${require_client.plural(errorCount, "file")} failed.`, duplicateCount < 1 ? false : ` ${require_client.picocolors.yellowBright("⚠")} ${require_client.picocolors.yellowBright(duplicateCount)} ${require_client.plural(duplicateCount, "duplicate operation")} skipped.`));
347
+ return require_formatter.picocolors.bold(require_formatter.joinLinesLoose(require_formatter.joinInline(require_formatter.picocolors.yellowBright("⚠"), require_formatter.picocolors.blueBright(label) + require_formatter.picocolors.gray(" -"), require_formatter.picocolors.whiteBright(successCount > 0 ? "Some" : "All"), require_formatter.picocolors.whiteBright("files"), require_formatter.picocolors.redBright("failed to copy") + ":"), successCount < 1 ? false : ` ${require_formatter.picocolors.greenBright("✔")} ${require_formatter.picocolors.greenBright(successCount)} ${require_formatter.plural(successCount, "file")} copied.`, errorCount < 1 ? false : ` ${require_formatter.picocolors.redBright("✖")} ${require_formatter.picocolors.redBright(errorCount)} ${require_formatter.plural(errorCount, "file")} failed.`, duplicateCount < 1 ? false : ` ${require_formatter.picocolors.yellowBright("⚠")} ${require_formatter.picocolors.yellowBright(duplicateCount)} ${require_formatter.plural(duplicateCount, "duplicate operation")} skipped.`));
400
348
  }
401
349
  function buildOperationKey(item) {
402
350
  return [
@@ -408,39 +356,39 @@ function buildOperationKey(item) {
408
356
  ].join("|");
409
357
  }
410
358
  function createCopyFileToDestParameterSet(items) {
411
- return new Set(require_helper.isArray(items) ? items : [items]);
359
+ return new Set(require_formatter.isArray(items) ? items : [items]);
412
360
  }
413
361
  const commandCftdIdentity = new require_identity.CommandIdentity({ defaultCommandName: "copy-file-to-dest" });
414
362
  async function copyFileToDest(parameter, options = {}) {
415
363
  const loggerLevel = resolveLogVerbosity(options);
416
364
  try {
417
365
  const { __commandTitle } = options;
418
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandCftdIdentity.utility(), ""));
419
- if (require_helper.isArray(parameter) || require_helper.isSet(parameter)) {
366
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandCftdIdentity.utility(), ""));
367
+ if (require_formatter.isArray(parameter) || require_formatter.isSet(parameter)) {
420
368
  let i = 0;
421
369
  for (const item of parameter) validateItem(item, i++);
422
- } else if (require_helper.isPlainObject(parameter)) validateItem(parameter);
370
+ } else if (require_formatter.isPlainObject(parameter)) validateItem(parameter);
423
371
  else throw new TypeError("Parameter argument must be a 'plain object', 'array of plain objects' or an 'set of plain objects'!");
424
- const list = [...require_helper.toObjectSet(parameter)];
372
+ const list = [...require_formatter.toObjectSet(parameter)];
425
373
  const uniqueLists = [];
426
374
  const seenOperations = /* @__PURE__ */ new Set();
427
375
  if (canLog(loggerLevel, VERBOSE_LOG)) {
428
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
376
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
429
377
  list.forEach((item, i) => {
430
378
  const { source, target, fileName = DEFAULT_CFTD_OPTIONS.fileName, outputRoot = DEFAULT_CFTD_OPTIONS.outputRoot, absoluteTarget = DEFAULT_CFTD_OPTIONS.absoluteTarget, ignoreMissingSourceError = DEFAULT_CFTD_OPTIONS.ignoreMissingSourceError } = item;
431
379
  const defaultFileName = fileName ?? node_path.default.basename(source);
432
380
  const indexText = list.length > 1 ? `[${i}]` : "";
433
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.source`, source, "overridden", true);
434
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.target`, target, "overridden", true);
435
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.fileName`, fileName || defaultFileName, BUILD_LOGGER.SOURCE_OF(fileName, DEFAULT_CFTD_OPTIONS.fileName));
436
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.outputRoot`, outputRoot, BUILD_LOGGER.SOURCE_OF(outputRoot, DEFAULT_CFTD_OPTIONS.outputRoot));
437
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.absoluteTarget`, absoluteTarget, BUILD_LOGGER.SOURCE_OF(absoluteTarget, DEFAULT_CFTD_OPTIONS.absoluteTarget));
438
- BUILD_LOGGER.OPTIONS(`options.copy${indexText}.ignoreMissingSourceError`, ignoreMissingSourceError, BUILD_LOGGER.SOURCE_OF(ignoreMissingSourceError, DEFAULT_CFTD_OPTIONS.ignoreMissingSourceError));
439
- if (i < list.length - 1) console.log(require_client.picocolors.gray(" =========================================================================="));
381
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.source`, source, "overridden", true);
382
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.target`, target, "overridden", true);
383
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.fileName`, fileName || defaultFileName, require_server.BUILD_LOGGER.SOURCE_OF(fileName, DEFAULT_CFTD_OPTIONS.fileName));
384
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.outputRoot`, outputRoot, require_server.BUILD_LOGGER.SOURCE_OF(outputRoot, DEFAULT_CFTD_OPTIONS.outputRoot));
385
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.absoluteTarget`, absoluteTarget, require_server.BUILD_LOGGER.SOURCE_OF(absoluteTarget, DEFAULT_CFTD_OPTIONS.absoluteTarget));
386
+ require_server.BUILD_LOGGER.OPTIONS(`options.copy${indexText}.ignoreMissingSourceError`, ignoreMissingSourceError, require_server.BUILD_LOGGER.SOURCE_OF(ignoreMissingSourceError, DEFAULT_CFTD_OPTIONS.ignoreMissingSourceError));
387
+ if (i < list.length - 1) console.log(require_formatter.picocolors.gray(" =========================================================================="));
440
388
  });
441
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_LOG_LEVEL));
442
- BUILD_LOGGER.NEW_LINE();
443
- BUILD_LOGGER.ON_STARTING({
389
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_LOG_LEVEL));
390
+ require_server.BUILD_LOGGER.NEW_LINE();
391
+ require_server.BUILD_LOGGER.ON_STARTING({
444
392
  actionName: "Copy File",
445
393
  textDirectAction: "action:"
446
394
  });
@@ -453,12 +401,12 @@ async function copyFileToDest(parameter, options = {}) {
453
401
  const key = buildOperationKey(item);
454
402
  if (seenOperations.has(key)) {
455
403
  duplicateCount++;
456
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_SKIPPING({
404
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_SKIPPING({
457
405
  actionName: "Copy File",
458
406
  reasonType: "",
459
407
  textDirectAction: "at",
460
408
  reasonSkipAction: "duplicate operation",
461
- reasonEndText: item.source + " " + require_client.picocolors.blueBright(`('parameter' index: ${require_client.picocolors.magentaBright(index)})`)
409
+ reasonEndText: item.source + " " + require_formatter.picocolors.blueBright(`('parameter' index: ${require_formatter.picocolors.magentaBright(index)})`)
462
410
  });
463
411
  continue;
464
412
  }
@@ -477,7 +425,7 @@ async function copyFileToDest(parameter, options = {}) {
477
425
  if (!await require_server.fsExtra.pathExists(absSource)) {
478
426
  if (ignoreMissingSourceError) continue;
479
427
  errorCount++;
480
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_PROCESS_COPY_ERROR({
428
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_PROCESS_COPY_ERROR({
481
429
  copyFrom: source,
482
430
  index: uniqList.index,
483
431
  indexKey: "parameter",
@@ -492,7 +440,7 @@ async function copyFileToDest(parameter, options = {}) {
492
440
  await require_server.fsExtra.copy(absSource, absTargetFile);
493
441
  const relSrc = node_path.default.relative(procCwd, absSource).replace(/\\/g, "/");
494
442
  const relDest = node_path.default.relative(procCwd, absTargetFile).replace(/\\/g, "/");
495
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS_COPY({
443
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS_COPY({
496
444
  actionName: "File copied",
497
445
  count,
498
446
  copyFrom: relSrc,
@@ -502,26 +450,26 @@ async function copyFileToDest(parameter, options = {}) {
502
450
  }
503
451
  const successCount = count - errorCount;
504
452
  if ((errorCount > 0 || duplicateCount > 0) && loggerLevel !== "silent" && !canLog(loggerLevel, VERBOSE_LOG)) console.log(buildCopySummary(successCount, errorCount, duplicateCount, "[Copy File to Dest]"));
505
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0 && errorCount === 0 && duplicateCount === 0) BUILD_LOGGER.ON_FINISH({
453
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0 && errorCount === 0 && duplicateCount === 0) require_server.BUILD_LOGGER.ON_FINISH({
506
454
  textSuccess: "Successfully",
507
455
  actionName: "copied",
508
456
  count
509
457
  });
510
458
  else if (successCount > 0) console.log(buildCopySummary(successCount, errorCount, duplicateCount, "[Copy File to Dest]"));
511
- else if (successCount === 0 && errorCount !== 0) BUILD_LOGGER.ON_SKIPPING({
459
+ else if (successCount === 0 && errorCount !== 0) require_server.BUILD_LOGGER.ON_SKIPPING({
512
460
  actionName: "\"Copy File\"",
513
461
  reasonSkipAction: "failed",
514
462
  reasonEndText: `${count > 1 ? "all " : ""}files`,
515
463
  reasonType: "to",
516
464
  textDirectAction: "copy"
517
465
  });
518
- else BUILD_LOGGER.ON_SKIPPING({
466
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
519
467
  actionName: "\"Copy File\"",
520
468
  reasonSkipAction: errorCount > 0 ? "nothing found" : "nothing",
521
469
  reasonEndText: "copy"
522
470
  });
523
471
  } catch (error) {
524
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
472
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
525
473
  actionName: "Copying File",
526
474
  error
527
475
  });
@@ -555,44 +503,44 @@ function getMissingCssStatements(body, cssImports, kind, dedupe) {
555
503
  };
556
504
  }
557
505
  function injectCssSmart({ shebang, banner, directives, rest, cssStatements, kind, minify }) {
558
- let out = minify ? shebang.trim() + require_client.EOL : shebang;
559
- out += minify ? banner.trim() + require_client.EOL : banner;
506
+ let out = minify ? shebang.trim() + require_formatter.EOL : shebang;
507
+ out += minify ? banner.trim() + require_formatter.EOL : banner;
560
508
  let finalDirectives = stripUseStrict(directives, {
561
509
  trimEnd: minify,
562
510
  trimStart: minify
563
511
  });
564
- if (kind === "cjs") finalDirectives = `"use strict";${require_client.EOL}` + finalDirectives.trimStart();
512
+ if (kind === "cjs") finalDirectives = `"use strict";${require_formatter.EOL}` + finalDirectives.trimStart();
565
513
  out += finalDirectives;
566
- out += cssStatements.join(require_client.EOL) + (minify ? "" : require_client.EOL);
567
- out += rest.replace(/^\n+/, minify ? "" : require_client.EOL);
514
+ out += cssStatements.join(require_formatter.EOL) + (minify ? "" : require_formatter.EOL);
515
+ out += rest.replace(/^\n+/, minify ? "" : require_formatter.EOL);
568
516
  return out.trimStart();
569
517
  }
570
518
  function normalizeCssImports(input) {
571
- return require_helper.flattenStrings(require_helper.isArray(input) ? input : [input]).map((s) => s.trim()).filter(Boolean);
519
+ return require_formatter.flattenStrings(require_formatter.isArray(input) ? input : [input]).map((s) => s.trim()).filter(Boolean);
572
520
  }
573
521
  const commandEciIdentity = new require_identity.CommandIdentity({ defaultCommandName: "ensure-css-import" });
574
522
  const ensureCssImport = async (pattern, options) => {
575
523
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_ECI_OPTIONS.logLevel);
576
524
  try {
577
525
  const { patternOptions = DEFAULT_ECI_OPTIONS.patternOptions, cssImportPath, dedupe = DEFAULT_ECI_OPTIONS.dedupe, sort = DEFAULT_ECI_OPTIONS.sort, minify = DEFAULT_ECI_OPTIONS.minify, __commandTitle } = options;
578
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandEciIdentity.utility(), ""));
579
- const patterns = [...require_helper.toStringSet(pattern)];
526
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandEciIdentity.utility(), ""));
527
+ const patterns = [...require_formatter.toStringSet(pattern)];
580
528
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_ECI_PATTERN_POLICY);
581
529
  let cssImports = normalizeCssImports(cssImportPath);
582
530
  if (cssImports.length === 0) throw new Error("`cssImportPath` option must not be empty.");
583
531
  if (dedupe) cssImports = Array.from(new Set(cssImports));
584
532
  if (sort) cssImports.sort();
585
533
  if (canLog(loggerLevel, VERBOSE_LOG)) {
586
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
587
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
588
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_ECI_OPTIONS.patternOptions));
589
- BUILD_LOGGER.OPTIONS("options.cssImportPath", cssImports, BUILD_LOGGER.SOURCE_OF(cssImports, DEFAULT_ECI_OPTIONS.cssImportPath), true);
590
- BUILD_LOGGER.OPTIONS("options.dedupe", dedupe, BUILD_LOGGER.SOURCE_OF(dedupe, DEFAULT_ECI_OPTIONS.dedupe));
591
- BUILD_LOGGER.OPTIONS("options.sort", sort, BUILD_LOGGER.SOURCE_OF(sort, DEFAULT_ECI_OPTIONS.sort));
592
- BUILD_LOGGER.OPTIONS("options.minify", minify, BUILD_LOGGER.SOURCE_OF(minify, DEFAULT_ECI_OPTIONS.minify));
593
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_ECI_OPTIONS.logLevel));
594
- BUILD_LOGGER.NEW_LINE();
595
- BUILD_LOGGER.ON_STARTING({ actionName: "Ensuring CSS Import" });
534
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
535
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
536
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_ECI_OPTIONS.patternOptions));
537
+ require_server.BUILD_LOGGER.OPTIONS("options.cssImportPath", cssImports, require_server.BUILD_LOGGER.SOURCE_OF(cssImports, DEFAULT_ECI_OPTIONS.cssImportPath), true);
538
+ require_server.BUILD_LOGGER.OPTIONS("options.dedupe", dedupe, require_server.BUILD_LOGGER.SOURCE_OF(dedupe, DEFAULT_ECI_OPTIONS.dedupe));
539
+ require_server.BUILD_LOGGER.OPTIONS("options.sort", sort, require_server.BUILD_LOGGER.SOURCE_OF(sort, DEFAULT_ECI_OPTIONS.sort));
540
+ require_server.BUILD_LOGGER.OPTIONS("options.minify", minify, require_server.BUILD_LOGGER.SOURCE_OF(minify, DEFAULT_ECI_OPTIONS.minify));
541
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_ECI_OPTIONS.logLevel));
542
+ require_server.BUILD_LOGGER.NEW_LINE();
543
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Ensuring CSS Import" });
596
544
  }
597
545
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
598
546
  let count = 0;
@@ -628,24 +576,24 @@ const ensureCssImport = async (pattern, options) => {
628
576
  throw err;
629
577
  }
630
578
  count++;
631
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
579
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
632
580
  actionName: "CSS Import",
633
581
  count,
634
582
  nameDirect: filePath
635
583
  });
636
584
  }
637
585
  }
638
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
586
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
639
587
  actionName: "Ensuring CSS Import",
640
588
  count
641
589
  });
642
- else BUILD_LOGGER.ON_SKIPPING({
590
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
643
591
  actionName: "Ensuring CSS Import",
644
592
  reasonType: "file",
645
593
  reasonEndText: "check"
646
594
  });
647
595
  } catch (error) {
648
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
596
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
649
597
  actionName: "Ensuring CSS Import",
650
598
  error
651
599
  });
@@ -665,16 +613,16 @@ const ensureFinalNewline = async (pattern, options = {}) => {
665
613
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_EFN_OPTIONS.logLevel);
666
614
  try {
667
615
  const { __commandTitle, patternOptions = DEFAULT_EFN_OPTIONS.patternOptions } = options;
668
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandEfnIdentity.utility(), ""));
669
- const patterns = [...require_helper.toStringSet(pattern)];
616
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandEfnIdentity.utility(), ""));
617
+ const patterns = [...require_formatter.toStringSet(pattern)];
670
618
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_EFN_PATTERN_POLICY);
671
619
  if (canLog(loggerLevel, VERBOSE_LOG)) {
672
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
673
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
674
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_EFN_OPTIONS.patternOptions));
675
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_EFN_OPTIONS.logLevel));
676
- BUILD_LOGGER.NEW_LINE();
677
- BUILD_LOGGER.ON_STARTING({ actionName: "Ensuring Final Newline" });
620
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
621
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
622
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_EFN_OPTIONS.patternOptions));
623
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_EFN_OPTIONS.logLevel));
624
+ require_server.BUILD_LOGGER.NEW_LINE();
625
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Ensuring Final Newline" });
678
626
  }
679
627
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
680
628
  let count = 0;
@@ -686,7 +634,7 @@ const ensureFinalNewline = async (pattern, options = {}) => {
686
634
  if (err.code === "ENOENT") continue;
687
635
  throw err;
688
636
  }
689
- const normalized = content.replace(/(\r?\n)*$/, require_client.EOL);
637
+ const normalized = content.replace(/(\r?\n)*$/, require_formatter.EOL);
690
638
  if (normalized === content) continue;
691
639
  try {
692
640
  await require_server.fsExtra.promises.writeFile(filePath, normalized, "utf8");
@@ -695,32 +643,32 @@ const ensureFinalNewline = async (pattern, options = {}) => {
695
643
  throw err;
696
644
  }
697
645
  count++;
698
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
646
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
699
647
  actionName: "Final Newline",
700
648
  count,
701
649
  nameDirect: filePath
702
650
  });
703
651
  }
704
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
652
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
705
653
  actionName: "Ensuring Final Newline",
706
654
  count
707
655
  });
708
- else if (files.length < 1) BUILD_LOGGER.ON_SKIPPING({
656
+ else if (files.length < 1) require_server.BUILD_LOGGER.ON_SKIPPING({
709
657
  actionName: "Ensuring Final Newline",
710
- reasonSkipAction: `no files found matching the pattern${require_client.picocolors.reset(",")}`,
658
+ reasonSkipAction: `no files found matching the pattern${require_formatter.picocolors.reset(",")}`,
711
659
  reasonType: "",
712
660
  textDirectAction: "no need to fix",
713
661
  reasonEndText: "end of file (EOF)"
714
662
  });
715
- else BUILD_LOGGER.ON_SKIPPING({
663
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
716
664
  actionName: "Ensuring Final Newline",
717
- reasonSkipAction: `all files are valid${require_client.picocolors.reset(",")}`,
665
+ reasonSkipAction: `all files are valid${require_formatter.picocolors.reset(",")}`,
718
666
  reasonType: "",
719
667
  textDirectAction: "no need to fix",
720
668
  reasonEndText: "end of file (EOF)"
721
669
  });
722
670
  } catch (error) {
723
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
671
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
724
672
  actionName: "Ensuring Final Newline",
725
673
  error
726
674
  });
@@ -768,9 +716,9 @@ const validateOut = ({ outDir, outFileName, inputDirReference }) => {
768
716
  };
769
717
  const resolveBanner = async (banner) => {
770
718
  if (banner === false) return "";
771
- if (banner === true) return await require_package_banner.generatePackageBanner() + require_client.EOL;
719
+ if (banner === true) return await require_package_banner.generatePackageBanner() + require_formatter.EOL;
772
720
  const resolved = await banner;
773
- return require_helper.isNonEmptyString(resolved) ? resolved : "";
721
+ return require_formatter.isNonEmptyString(resolved) ? resolved : "";
774
722
  };
775
723
  const commandGriIdentity = new require_identity.CommandIdentity({ defaultCommandName: "generate-reference-index" });
776
724
  const generateReferenceIndex = async (pattern, options = {}) => {
@@ -779,21 +727,21 @@ const generateReferenceIndex = async (pattern, options = {}) => {
779
727
  try {
780
728
  const { __commandTitle, patternOptions = DEFAULT_GRI_OPTIONS.patternOptions, outDir: _outDir = DEFAULT_GRI_OPTIONS.outDir, outFileName: _outFileName = DEFAULT_GRI_OPTIONS.outFileName, inputDirReference: _inputDirReference = DEFAULT_GRI_OPTIONS.inputDirReference, withExportTypes = DEFAULT_GRI_OPTIONS.withExportTypes, banner = DEFAULT_GRI_OPTIONS.banner, onlyDeclarations = DEFAULT_GRI_OPTIONS.onlyDeclarations } = options;
781
729
  _withExportTypes = withExportTypes;
782
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandGriIdentity.utility(), ""));
783
- const patterns = [...require_helper.toStringSet(pattern)];
730
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandGriIdentity.utility(), ""));
731
+ const patterns = [...require_formatter.toStringSet(pattern)];
784
732
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_GRI_PATTERN_POLICY);
785
733
  if (canLog(loggerLevel, VERBOSE_LOG)) {
786
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
787
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
788
- BUILD_LOGGER.OPTIONS("outDir", _outDir, sourceOf(_outDir, DEFAULT_GRI_OPTIONS.outDir));
789
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_GRI_OPTIONS.patternOptions));
790
- BUILD_LOGGER.OPTIONS("options.outFileName", _outFileName, sourceOf(_outFileName, DEFAULT_GRI_OPTIONS.outFileName));
791
- BUILD_LOGGER.OPTIONS("options.inputDirReference", _inputDirReference, sourceOf(_inputDirReference, DEFAULT_GRI_OPTIONS.inputDirReference));
792
- BUILD_LOGGER.OPTIONS("options.withExportTypes", withExportTypes, sourceOf(withExportTypes, DEFAULT_GRI_OPTIONS.withExportTypes));
793
- BUILD_LOGGER.OPTIONS("options.banner", banner, sourceOf(banner, DEFAULT_GRI_OPTIONS.banner));
794
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_GRI_OPTIONS.logLevel));
795
- BUILD_LOGGER.NEW_LINE();
796
- BUILD_LOGGER.ON_STARTING({ actionName: "Generating References" });
734
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
735
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
736
+ require_server.BUILD_LOGGER.OPTIONS("outDir", _outDir, require_server.sourceOf(_outDir, DEFAULT_GRI_OPTIONS.outDir));
737
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_GRI_OPTIONS.patternOptions));
738
+ require_server.BUILD_LOGGER.OPTIONS("options.outFileName", _outFileName, require_server.sourceOf(_outFileName, DEFAULT_GRI_OPTIONS.outFileName));
739
+ require_server.BUILD_LOGGER.OPTIONS("options.inputDirReference", _inputDirReference, require_server.sourceOf(_inputDirReference, DEFAULT_GRI_OPTIONS.inputDirReference));
740
+ require_server.BUILD_LOGGER.OPTIONS("options.withExportTypes", withExportTypes, require_server.sourceOf(withExportTypes, DEFAULT_GRI_OPTIONS.withExportTypes));
741
+ require_server.BUILD_LOGGER.OPTIONS("options.banner", banner, require_server.sourceOf(banner, DEFAULT_GRI_OPTIONS.banner));
742
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_GRI_OPTIONS.logLevel));
743
+ require_server.BUILD_LOGGER.NEW_LINE();
744
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Generating References" });
797
745
  }
798
746
  let files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
799
747
  if (onlyDeclarations) files = files.filter((file) => TS_DECLARATION_FILE_RE.test(file));
@@ -813,7 +761,7 @@ const generateReferenceIndex = async (pattern, options = {}) => {
813
761
  if (!referencedAbs.startsWith(inputDirRefAbs + node_path.default.sep) || referencedAbs === outFileAbs) return;
814
762
  const referencePath = normalizeRelative(node_path.default.dirname(outFileAbs), referencedAbs);
815
763
  const displayPath = `${inputDirReference}/${node_path.default.relative(inputDirRefAbs, referencedAbs).replace(/\\/g, "/")}`;
816
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS_REFERENCING({
764
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS_REFERENCING({
817
765
  actionName: "Generated Reference",
818
766
  count: i + 1,
819
767
  referenceFrom: displayPath,
@@ -824,22 +772,22 @@ const generateReferenceIndex = async (pattern, options = {}) => {
824
772
  }).filter(Boolean);
825
773
  if (Array.isArray(reference) && reference.length > 0) {
826
774
  lines.add("//! References Paths:");
827
- lines.add(reference.join(require_client.EOL));
775
+ lines.add(reference.join(require_formatter.EOL));
828
776
  }
829
- if (canLog(loggerLevel, VERBOSE_LOG)) if (referenceCount > 0) BUILD_LOGGER.ON_FINISH({
777
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (referenceCount > 0) require_server.BUILD_LOGGER.ON_FINISH({
830
778
  actionName: "Generating Reference",
831
779
  count: files.length,
832
780
  typeCount: "reference"
833
781
  });
834
- else BUILD_LOGGER.ON_SKIPPING({
782
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
835
783
  actionName: "Generating References",
836
784
  reasonEndText: "referencing",
837
785
  reasonType: "references"
838
786
  });
839
787
  if (withExportTypes) {
840
788
  if (canLog(loggerLevel, VERBOSE_LOG)) {
841
- console.log(require_client.picocolors.bold(require_client.picocolors.magentaBright(`${require_client.EOL}=======================================================================================${require_client.EOL}`)));
842
- BUILD_LOGGER.ON_STARTING({ actionName: "Adding Exported Types" });
789
+ console.log(require_formatter.picocolors.bold(require_formatter.picocolors.magentaBright(`${require_formatter.EOL}=======================================================================================${require_formatter.EOL}`)));
790
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Adding Exported Types" });
843
791
  }
844
792
  const exportLines = /* @__PURE__ */ new Set();
845
793
  let exportCount = 0;
@@ -851,7 +799,7 @@ const generateReferenceIndex = async (pattern, options = {}) => {
851
799
  if (!exportLines.has(line)) {
852
800
  exportCount++;
853
801
  const displayPath = `${inputDirReference}/${node_path.default.relative(inputDirRefAbs, referencedAbs).replace(/\\/g, "/")}`;
854
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS_REFERENCING({
802
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS_REFERENCING({
855
803
  actionName: "Exported Type",
856
804
  count: exportCount,
857
805
  referenceFrom: displayPath,
@@ -863,13 +811,13 @@ const generateReferenceIndex = async (pattern, options = {}) => {
863
811
  if (exportLines.size > 0) {
864
812
  if (referenceCount > 0) lines.add("");
865
813
  lines.add("//! Exported Types:");
866
- lines.add([...exportLines].join(require_client.EOL));
867
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_FINISH({
814
+ lines.add([...exportLines].join(require_formatter.EOL));
815
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_FINISH({
868
816
  actionName: "Adding Exported Types",
869
817
  count: exportLines.size,
870
818
  typeCount: "type"
871
819
  });
872
- } else if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_SKIPPING({
820
+ } else if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_SKIPPING({
873
821
  actionName: "Adding Exported Types",
874
822
  reasonEndText: "exporting",
875
823
  reasonType: "types"
@@ -880,9 +828,9 @@ const generateReferenceIndex = async (pattern, options = {}) => {
880
828
  const action = withExportTypes ? "reference and type export" : "reference";
881
829
  lines.add(`// No files matched the given patterns and input dir references, skipping ${action} generation.`);
882
830
  }
883
- await require_server.fsExtra.promises.writeFile(outFileAbs, await resolveBanner(banner) + [...lines].join(require_client.EOL) + require_client.EOL);
831
+ await require_server.fsExtra.promises.writeFile(outFileAbs, await resolveBanner(banner) + [...lines].join(require_formatter.EOL) + require_formatter.EOL);
884
832
  } catch (error) {
885
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
833
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
886
834
  actionName: "Generating References" + (_withExportTypes ? " and Adding Exported Types" : ""),
887
835
  error
888
836
  });
@@ -905,23 +853,23 @@ const injectBanner = async (pattern, bannerText, options = {}) => {
905
853
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_LOG_LEVEL);
906
854
  try {
907
855
  const { __commandTitle, removeDuplicate = DEFAULT_IB_OPTIONS.removeDuplicate, bannerPosition = DEFAULT_IB_OPTIONS.bannerPosition, replaceBanner = DEFAULT_IB_OPTIONS.replaceBanner, patternOptions = DEFAULT_IB_OPTIONS.patternOptions } = options;
908
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandIbIdentity.utility(), ""));
909
- const patterns = [...require_helper.toStringSet(pattern)];
910
- const banners = require_helper.toStringSet(bannerText, { parameterKey: "bannerText" });
856
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandIbIdentity.utility(), ""));
857
+ const patterns = [...require_formatter.toStringSet(pattern)];
858
+ const banners = require_formatter.toStringSet(bannerText, { parameterKey: "bannerText" });
911
859
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_IB_PATTERN_POLICY);
912
860
  if (canLog(loggerLevel, VERBOSE_LOG)) {
913
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
914
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
915
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_IB_OPTIONS.patternOptions));
916
- BUILD_LOGGER.OPTIONS("options.removeDuplicate", removeDuplicate, BUILD_LOGGER.SOURCE_OF(removeDuplicate, DEFAULT_IB_OPTIONS.removeDuplicate));
917
- BUILD_LOGGER.OPTIONS("options.replaceBanner", replaceBanner, BUILD_LOGGER.SOURCE_OF(replaceBanner, DEFAULT_IB_OPTIONS.replaceBanner));
918
- BUILD_LOGGER.OPTIONS("options.bannerPosition", bannerPosition, BUILD_LOGGER.SOURCE_OF(bannerPosition, DEFAULT_IB_OPTIONS.bannerPosition));
919
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_IB_OPTIONS.logLevel));
920
- BUILD_LOGGER.NEW_LINE();
921
- BUILD_LOGGER.ON_STARTING({ actionName: "Injecting Banner" });
861
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
862
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
863
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_IB_OPTIONS.patternOptions));
864
+ require_server.BUILD_LOGGER.OPTIONS("options.removeDuplicate", removeDuplicate, require_server.BUILD_LOGGER.SOURCE_OF(removeDuplicate, DEFAULT_IB_OPTIONS.removeDuplicate));
865
+ require_server.BUILD_LOGGER.OPTIONS("options.replaceBanner", replaceBanner, require_server.BUILD_LOGGER.SOURCE_OF(replaceBanner, DEFAULT_IB_OPTIONS.replaceBanner));
866
+ require_server.BUILD_LOGGER.OPTIONS("options.bannerPosition", bannerPosition, require_server.BUILD_LOGGER.SOURCE_OF(bannerPosition, DEFAULT_IB_OPTIONS.bannerPosition));
867
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_IB_OPTIONS.logLevel));
868
+ require_server.BUILD_LOGGER.NEW_LINE();
869
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Injecting Banner" });
922
870
  }
923
871
  if (banners.size === 0) {
924
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_SKIPPING({
872
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_SKIPPING({
925
873
  actionName: "Inject Banner",
926
874
  reasonSkipAction: "empty bannerText",
927
875
  reasonType: "parameter",
@@ -940,7 +888,7 @@ const injectBanner = async (pattern, bannerText, options = {}) => {
940
888
  if (err.code === "ENOENT") continue;
941
889
  throw err;
942
890
  }
943
- if (!require_helper.isNonEmptyString(original)) continue;
891
+ if (!require_formatter.isNonEmptyString(original)) continue;
944
892
  if (!hasExecutableCode(original)) continue;
945
893
  const { body, shebang, banner: existingBanner } = extractAndHoistBanner(original);
946
894
  const bannerRegex = new RegExp(BANNER_RE.source, "g");
@@ -949,7 +897,7 @@ const injectBanner = async (pattern, bannerText, options = {}) => {
949
897
  const existingBlocks = existingBanner ? [...existingBanner.matchAll(bannerRegex)].map((m) => m[0]) : [];
950
898
  let finalBlocks = [];
951
899
  if (replaceBanner) {
952
- const replaceRegex = require_helper.isRegExp(replaceBanner) ? replaceBanner : BANNER_RE;
900
+ const replaceRegex = require_formatter.isRegExp(replaceBanner) ? replaceBanner : BANNER_RE;
953
901
  if (existingBanner && new RegExp(replaceRegex.source, replaceRegex.flags.replace("g", "")).test(existingBanner)) finalBlocks = [...newBlocks];
954
902
  else finalBlocks = bannerPosition === "top" ? [...newBlocks, ...existingBlocks] : [...existingBlocks, ...newBlocks];
955
903
  } else finalBlocks = bannerPosition === "top" ? [...newBlocks, ...existingBlocks] : [...existingBlocks, ...newBlocks];
@@ -963,8 +911,8 @@ const injectBanner = async (pattern, bannerText, options = {}) => {
963
911
  });
964
912
  }
965
913
  let content = shebang + finalBlocks.map((text) => {
966
- if (!text || !require_helper.isNonEmptyString(text)) return "";
967
- return text.replace(/\r\n/g, require_client.EOL).replace(/\n+$/, "") + require_client.EOL + require_client.EOL;
914
+ if (!text || !require_formatter.isNonEmptyString(text)) return "";
915
+ return text.replace(/\r\n/g, require_formatter.EOL).replace(/\n+$/, "") + require_formatter.EOL + require_formatter.EOL;
968
916
  }).join("") + body;
969
917
  try {
970
918
  await require_server.fsExtra.promises.writeFile(filePath, content, "utf8");
@@ -973,22 +921,22 @@ const injectBanner = async (pattern, bannerText, options = {}) => {
973
921
  throw err;
974
922
  }
975
923
  count++;
976
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
977
- actionName: "Banner Injected " + require_client.picocolors.cyanBright(replaceBanner ? "(replace mode)" : "(preserve mode)"),
924
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
925
+ actionName: "Banner Injected " + require_formatter.picocolors.cyanBright(replaceBanner ? "(replace mode)" : "(preserve mode)"),
978
926
  count,
979
927
  nameDirect: filePath
980
928
  });
981
929
  }
982
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
930
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
983
931
  actionName: "Inject Banner",
984
932
  count
985
933
  });
986
- else BUILD_LOGGER.ON_SKIPPING({
934
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
987
935
  actionName: "Inject Banner",
988
936
  reasonEndText: "injecting"
989
937
  });
990
938
  } catch (error) {
991
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
939
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
992
940
  actionName: "Inject Banner",
993
941
  error
994
942
  });
@@ -1008,19 +956,19 @@ const injectDirective = async (pattern, directive, options = {}) => {
1008
956
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_ID_OPTIONS.logLevel);
1009
957
  try {
1010
958
  const { __commandTitle, patternOptions = DEFAULT_ID_OPTIONS.patternOptions } = options;
1011
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandIdIdentity.utility(), ""));
1012
- const patterns = [...require_helper.toStringSet(pattern)];
959
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandIdIdentity.utility(), ""));
960
+ const patterns = [...require_formatter.toStringSet(pattern)];
1013
961
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_ID_PATTERN_POLICY);
1014
962
  if (canLog(loggerLevel, VERBOSE_LOG)) {
1015
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1016
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1017
- BUILD_LOGGER.OPTIONS("directive", directive, BUILD_LOGGER.SOURCE_OF(directive, void 0), true);
1018
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_ID_OPTIONS.patternOptions));
1019
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_ID_OPTIONS.logLevel));
1020
- BUILD_LOGGER.NEW_LINE();
1021
- BUILD_LOGGER.ON_STARTING({ actionName: "Inject Directive" });
963
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
964
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
965
+ require_server.BUILD_LOGGER.OPTIONS("directive", directive, require_server.BUILD_LOGGER.SOURCE_OF(directive, void 0), true);
966
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_ID_OPTIONS.patternOptions));
967
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_ID_OPTIONS.logLevel));
968
+ require_server.BUILD_LOGGER.NEW_LINE();
969
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Inject Directive" });
1022
970
  }
1023
- const directives = [...require_helper.toStringSet(directive)];
971
+ const directives = [...require_formatter.toStringSet(directive)];
1024
972
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
1025
973
  let count = 0;
1026
974
  for (const filePath of files) {
@@ -1032,7 +980,7 @@ const injectDirective = async (pattern, directive, options = {}) => {
1032
980
  if (err.code === "ENOENT") continue;
1033
981
  throw err;
1034
982
  }
1035
- if (!require_helper.isNonEmptyString(original) || !hasExecutableCode(original)) continue;
983
+ if (!require_formatter.isNonEmptyString(original) || !hasExecutableCode(original)) continue;
1036
984
  const { body, banner, shebang } = extractAndHoistBanner(original);
1037
985
  const { directives: extractedDirectives, rest } = extractDirectives(body);
1038
986
  const existing = new Set(extractedDirectives);
@@ -1051,7 +999,7 @@ const injectDirective = async (pattern, directive, options = {}) => {
1051
999
  }
1052
1000
  }
1053
1001
  if (!injectLines?.length) continue;
1054
- const finalDirective = injectLines.join(require_client.EOL) + require_client.EOL + stripUseStrict(extractedDirectives);
1002
+ const finalDirective = injectLines.join(require_formatter.EOL) + require_formatter.EOL + stripUseStrict(extractedDirectives);
1055
1003
  const content = shebang + banner + finalDirective + rest;
1056
1004
  try {
1057
1005
  await require_server.fsExtra.promises.writeFile(filePath, content, "utf8");
@@ -1060,22 +1008,22 @@ const injectDirective = async (pattern, directive, options = {}) => {
1060
1008
  throw err;
1061
1009
  }
1062
1010
  count++;
1063
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
1064
- actionName: "Directive Injected " + require_client.picocolors.cyanBright("(`" + injectLines.join("`, `") + "`)"),
1011
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
1012
+ actionName: "Directive Injected " + require_formatter.picocolors.cyanBright("(`" + injectLines.join("`, `") + "`)"),
1065
1013
  count,
1066
1014
  nameDirect: filePath
1067
1015
  });
1068
1016
  }
1069
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
1017
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
1070
1018
  actionName: "Inject Directive",
1071
1019
  count
1072
1020
  });
1073
- else BUILD_LOGGER.ON_SKIPPING({
1021
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
1074
1022
  actionName: "Inject Directive",
1075
1023
  reasonEndText: "injecting"
1076
1024
  });
1077
1025
  } catch (error) {
1078
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
1026
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
1079
1027
  actionName: "Inject Directive",
1080
1028
  error
1081
1029
  });
@@ -1095,16 +1043,16 @@ const normalizeJsBuildNewlines = async (pattern, options = {}) => {
1095
1043
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_NJBN_OPTIONS.logLevel);
1096
1044
  try {
1097
1045
  const { __commandTitle, patternOptions = DEFAULT_NJBN_OPTIONS.patternOptions } = options;
1098
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandNjbnIdentity.utility(), ""));
1099
- const patterns = [...require_helper.toStringSet(pattern)];
1046
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandNjbnIdentity.utility(), ""));
1047
+ const patterns = [...require_formatter.toStringSet(pattern)];
1100
1048
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_NJBN_PATTERN_POLICY);
1101
1049
  if (canLog(loggerLevel, VERBOSE_LOG)) {
1102
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1103
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1104
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_NJBN_OPTIONS.patternOptions));
1105
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_NJBN_OPTIONS.logLevel));
1106
- BUILD_LOGGER.NEW_LINE();
1107
- BUILD_LOGGER.ON_STARTING({ actionName: "Normalize New Lines" });
1050
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1051
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1052
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_NJBN_OPTIONS.patternOptions));
1053
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_NJBN_OPTIONS.logLevel));
1054
+ require_server.BUILD_LOGGER.NEW_LINE();
1055
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Normalize New Lines" });
1108
1056
  }
1109
1057
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
1110
1058
  const filesToClean = /* @__PURE__ */ new Set();
@@ -1130,7 +1078,7 @@ const normalizeJsBuildNewlines = async (pattern, options = {}) => {
1130
1078
  if (err.code === "ENOENT") continue;
1131
1079
  throw err;
1132
1080
  }
1133
- const finalContent = content.replace(/(\r?\n){3,}/g, require_client.EOL);
1081
+ const finalContent = content.replace(/(\r?\n){3,}/g, require_formatter.EOL);
1134
1082
  if (finalContent !== content) {
1135
1083
  try {
1136
1084
  await require_server.fsExtra.promises.writeFile(filePath, finalContent, "utf8");
@@ -1138,54 +1086,67 @@ const normalizeJsBuildNewlines = async (pattern, options = {}) => {
1138
1086
  if (err.code === "ENOENT") continue;
1139
1087
  throw err;
1140
1088
  }
1141
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
1089
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
1142
1090
  actionName: "New Line Normalized",
1143
1091
  count,
1144
1092
  nameDirect: filePath
1145
1093
  });
1146
1094
  }
1147
1095
  }
1148
- if (canLog(loggerLevel, VERBOSE_LOG)) if (filesToClean.size > 0) BUILD_LOGGER.ON_FINISH({
1096
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (filesToClean.size > 0) require_server.BUILD_LOGGER.ON_FINISH({
1149
1097
  actionName: "Normalize New Lines",
1150
1098
  count
1151
1099
  });
1152
- else BUILD_LOGGER.ON_SKIPPING({
1100
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
1153
1101
  actionName: "Normalize New Lines",
1154
1102
  reasonEndText: "normalize"
1155
1103
  });
1156
1104
  } catch (error) {
1157
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
1105
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
1158
1106
  actionName: "Normalize New Lines",
1159
1107
  error
1160
1108
  });
1161
1109
  }
1162
1110
  };
1163
1111
  function runCommand(command, argsOrOptions = [], maybeOptions = {}) {
1164
- assertValidCommand(command);
1165
- let args;
1166
- let options;
1167
- if (Array.isArray(argsOrOptions)) {
1168
- args = argsOrOptions;
1169
- options = maybeOptions;
1170
- } else {
1171
- args = [];
1172
- options = argsOrOptions;
1173
- }
1174
1112
  return new Promise((resolve, reject) => {
1175
- const { shell = true, stdio = "inherit", argv0: _argv0, useColors = true, ...restOption } = options;
1176
- const { child, setupLifecycle, cmdStringPlain } = spawnWithLifecycle(command, args, {
1177
- ...restOption,
1178
- stdio,
1179
- useColors,
1180
- shell
1181
- }, { rejectOnNonZero: true });
1182
- setupLifecycle({
1183
- onSuccess: (code) => {
1184
- if (code === 0) resolve(child);
1185
- else reject(/* @__PURE__ */ new Error(`${cmdStringPlain} exited with code ${code}`));
1186
- },
1187
- onError: reject
1188
- });
1113
+ try {
1114
+ let args;
1115
+ let options;
1116
+ const isArgsArray = require_formatter.isArray(argsOrOptions);
1117
+ if (isArgsArray) {
1118
+ args = argsOrOptions;
1119
+ options = maybeOptions;
1120
+ } else {
1121
+ args = [];
1122
+ options = argsOrOptions;
1123
+ }
1124
+ assertValidCommand(command, {
1125
+ apiType: "runCommand",
1126
+ useColors: options.useColors,
1127
+ allowInline: !isArgsArray
1128
+ });
1129
+ const { shell = true, stdio = "inherit", argv0: _argv0, useColors = true, ...restOption } = options;
1130
+ const { child, setupLifecycle, cmdStringPlain } = spawnWithLifecycle(command, args, {
1131
+ ...restOption,
1132
+ stdio,
1133
+ useColors,
1134
+ shell
1135
+ }, { rejectOnNonZero: true });
1136
+ setupLifecycle({
1137
+ onSuccess: (code) => {
1138
+ if (code === 0) resolve(child);
1139
+ else reject(/* @__PURE__ */ new Error(`${cmdStringPlain} exited with code ${code}`));
1140
+ },
1141
+ onError: reject
1142
+ });
1143
+ } catch (err) {
1144
+ const e = err instanceof Error ? err : new Error(String(err));
1145
+ const cleanedBase = stripInternalStack(((/* @__PURE__ */ new Error()).stack?.split(require_formatter.EOL).slice(1) ?? []).filter((line) => !line.includes("runCommand")));
1146
+ e.stack = [e.message, ...cleanedBase].join(require_formatter.EOL);
1147
+ reject(e);
1148
+ return;
1149
+ }
1189
1150
  });
1190
1151
  }
1191
1152
  function normalizeChunk(chunk) {
@@ -1194,74 +1155,89 @@ function normalizeChunk(chunk) {
1194
1155
  return String(chunk);
1195
1156
  }
1196
1157
  function runCommandCapture(command, argsOrOptions = [], maybeOptions = {}) {
1197
- assertValidCommand(command);
1198
- let args;
1199
- let options;
1200
- if (Array.isArray(argsOrOptions)) {
1201
- args = argsOrOptions;
1202
- options = maybeOptions;
1203
- } else {
1204
- args = [];
1205
- options = argsOrOptions;
1206
- }
1207
- const { shell = true, signal, timeout, forceKill, useColors = true, argv0: _argv0, ...restOption } = options;
1208
1158
  return new Promise((resolve, reject) => {
1209
- const { child, setupLifecycle } = spawnWithLifecycle(command, args, {
1210
- ...restOption,
1211
- stdio: "pipe",
1212
- shell,
1213
- signal,
1214
- timeout,
1215
- forceKill,
1216
- useColors
1217
- }, { rejectOnNonZero: false });
1218
- let stdout = "";
1219
- let stderr = "";
1220
- child.stdout?.on("data", (chunk) => {
1221
- stdout += normalizeChunk(chunk);
1222
- });
1223
- child.stderr?.on("data", (chunk) => {
1224
- stderr += normalizeChunk(chunk);
1225
- });
1226
- setupLifecycle({
1227
- onSuccess: (code) => {
1228
- resolve({
1229
- stdout: stdout.trimEnd(),
1230
- stderr: stderr.trimEnd(),
1231
- exitCode: code,
1232
- ok: code === 0
1233
- });
1234
- },
1235
- onError: reject
1236
- });
1159
+ try {
1160
+ let args;
1161
+ let options;
1162
+ const isArgsArray = require_formatter.isArray(argsOrOptions);
1163
+ if (isArgsArray) {
1164
+ args = argsOrOptions;
1165
+ options = maybeOptions;
1166
+ } else {
1167
+ args = [];
1168
+ options = argsOrOptions;
1169
+ }
1170
+ assertValidCommand(command, {
1171
+ apiType: "runCommandCapture",
1172
+ useColors: options.useColors,
1173
+ allowInline: !isArgsArray
1174
+ });
1175
+ const { shell = true, signal, timeout, forceKill, useColors = true, argv0: _argv0, ...restOption } = options;
1176
+ const { child, setupLifecycle } = spawnWithLifecycle(command, args, {
1177
+ ...restOption,
1178
+ stdio: "pipe",
1179
+ shell,
1180
+ signal,
1181
+ timeout,
1182
+ forceKill,
1183
+ useColors
1184
+ }, { rejectOnNonZero: false });
1185
+ let stdout = "";
1186
+ let stderr = "";
1187
+ child.stdout?.on("data", (chunk) => {
1188
+ stdout += normalizeChunk(chunk);
1189
+ });
1190
+ child.stderr?.on("data", (chunk) => {
1191
+ stderr += normalizeChunk(chunk);
1192
+ });
1193
+ setupLifecycle({
1194
+ onSuccess: (code) => {
1195
+ resolve({
1196
+ stdout: stdout.trimEnd(),
1197
+ stderr: formatMessageColor(stderr.trimEnd(), useColors),
1198
+ exitCode: code,
1199
+ ok: code === 0
1200
+ });
1201
+ },
1202
+ onError: reject
1203
+ });
1204
+ } catch (err) {
1205
+ const e = err instanceof Error ? err : new Error(String(err));
1206
+ const cleanedBase = stripInternalStack(((/* @__PURE__ */ new Error()).stack?.split(require_formatter.EOL).slice(1) ?? []).filter((line) => !line.includes("runCommandCapture")));
1207
+ e.stack = [e.message, ...cleanedBase].join(require_formatter.EOL);
1208
+ reject(e);
1209
+ return;
1210
+ }
1237
1211
  });
1238
1212
  }
1213
+ const formatMessageColor = (message, useColors = true) => {
1214
+ return useColors ? require_formatter.picocolors.redBright(message) : message;
1215
+ };
1239
1216
  function formatCommand(command, args, { useColors = true } = {}) {
1240
1217
  const hasArgs = args.length > 0;
1241
- const argsString = hasArgs ? args.map((a) => require_helper.safeStableStringify(a)).join(" ") : "";
1242
- if (useColors) {
1243
- const cmd = require_client.picocolors.cyanBright(command);
1244
- return hasArgs ? `${cmd} ${require_client.picocolors.gray(argsString)}` : cmd;
1245
- }
1246
- return hasArgs ? `${command} ${argsString}` : command;
1218
+ const argsString = hasArgs ? args.map((a) => require_formatter.safeStableStringify(a)).join(" ") : "";
1219
+ if (!hasArgs) return formatMessageColor(command, useColors);
1220
+ if (useColors) return `${require_formatter.picocolors.cyanBright(command)} ${require_formatter.picocolors.gray(argsString)}`;
1221
+ return `${command} ${argsString}`;
1247
1222
  }
1248
- function assertValidCommand(command, { useColors = true } = {}) {
1249
- if (typeof command !== "string") {
1250
- const errorMsg = `Invalid command: expected a string, received ${require_helper.safeStableStringify(command)}`;
1251
- throw new TypeError(useColors ? require_client.picocolors.redBright(errorMsg) : errorMsg);
1223
+ function assertValidCommand(command, options) {
1224
+ const { useColors = true, allowInline = false, apiType } = options || {};
1225
+ if (!require_formatter.isString(command)) {
1226
+ const errorMsg = `Invalid command: expected a string, received ${require_formatter.safeStableStringify(command)}`;
1227
+ throw new TypeError(formatMessageColor(errorMsg, useColors));
1252
1228
  }
1253
1229
  const trimmed = command.trim();
1254
- if (trimmed.length === 0) {
1255
- const errorMsg = "Invalid command: command cannot be empty";
1256
- throw new Error(useColors ? require_client.picocolors.redBright(errorMsg) : errorMsg);
1230
+ if (trimmed.length === 0) throw new Error(formatMessageColor("Invalid command: command cannot be empty", useColors));
1231
+ const hasSpace = /\s/.test(trimmed);
1232
+ if (hasShellSyntax(trimmed)) {
1233
+ const errorMsg = require_formatter.joinLinesLoose(`Invalid command: "${trimmed}"`, "Shell operators are not supported in this context (e.g. &&, ||, |, >).", "This utility only supports a single command with arguments.");
1234
+ throw new Error(formatMessageColor(errorMsg, useColors));
1257
1235
  }
1258
- const hasSpace = trimmed.includes(" ");
1259
- const hasQuotes = /['"`]/.test(trimmed);
1260
- const hasShellOps = /[|&;<>(){}$]/.test(trimmed);
1261
- if (hasSpace || hasQuotes || hasShellOps) {
1236
+ if (!allowInline && hasSpace) {
1262
1237
  const [cmd, ...rest] = trimmed.split(/\s+/);
1263
- const errorMsg = require_client.joinLinesLoose(`Invalid command: "${trimmed}"`, "Do not pass a full shell command.", `Use arguments instead: runCommand("${cmd}", ${require_helper.safeStableStringify(rest)})`);
1264
- throw new Error(useColors ? require_client.picocolors.redBright(errorMsg) : errorMsg);
1238
+ if (!cmd) throw new Error("Invalid command: unable to resolve executable.");
1239
+ const errorMsg = require_formatter.joinLinesLoose(`Invalid command: "${trimmed}"`, "Do not include arguments in the command when passing them separately.", `Use: ${apiType}("${cmd}", ${require_formatter.safeStableStringify(rest)})`);
1240
+ throw new Error(formatMessageColor(errorMsg, useColors));
1265
1241
  }
1266
1242
  }
1267
1243
  function stripInternalStack(lines) {
@@ -1273,8 +1249,10 @@ function stripInternalStack(lines) {
1273
1249
  "createProcessError",
1274
1250
  "formatError",
1275
1251
  "spawnWithLifecycle",
1252
+ "assertValidCommand",
1276
1253
  "setupLifecycle",
1277
- "node:internal"
1254
+ "node:internal",
1255
+ "node:internal/process/promises"
1278
1256
  ];
1279
1257
  return lines.filter((line) => {
1280
1258
  if (blacklist.some((key) => line.includes(key))) return false;
@@ -1291,8 +1269,8 @@ function createProcessError(message, { reason, exitCode, signal, command }, base
1291
1269
  signal,
1292
1270
  command
1293
1271
  });
1294
- const currentStack = error.stack?.split(require_client.EOL) ?? [];
1295
- const base = baseStack?.split(require_client.EOL) ?? [];
1272
+ const currentStack = error.stack?.split(require_formatter.EOL) ?? [];
1273
+ const base = baseStack?.split(require_formatter.EOL) ?? [];
1296
1274
  const [currentHead, ...currentRest] = currentStack;
1297
1275
  const [, ...baseRest] = base;
1298
1276
  const cleanedCurrent = stripInternalStack(currentRest);
@@ -1302,7 +1280,7 @@ function createProcessError(message, { reason, exitCode, signal, command }, base
1302
1280
  currentHead,
1303
1281
  ...cleanedCurrent,
1304
1282
  ...cleanedBase.length ? [...cleanedBase] : []
1305
- ].join(require_client.EOL);
1283
+ ].join(require_formatter.EOL);
1306
1284
  Object.defineProperties(error, {
1307
1285
  reason: {
1308
1286
  value: reason,
@@ -1321,7 +1299,7 @@ function createProcessError(message, { reason, exitCode, signal, command }, base
1321
1299
  enumerable: false
1322
1300
  }
1323
1301
  });
1324
- error.stack += require_client.joinLinesLoose("", "meta:", ` reason: ${require_client.formatOptionValue(reason)}`, ` exitCode: ${require_client.formatOptionValue(exitCode ?? null)}`, ` signal: ${require_client.formatOptionValue(signal ?? null)}`, ` command: ${require_client.formatOptionValue(command)}`);
1302
+ error.stack += require_formatter.joinLinesLoose("", "meta:", ` reason: ${require_formatter.formatOptionValue(reason)}`, ` exitCode: ${require_formatter.formatOptionValue(exitCode ?? null)}`, ` signal: ${require_formatter.formatOptionValue(signal ?? null)}`, ` command: ${require_formatter.formatOptionValue(command)}`);
1325
1303
  return error;
1326
1304
  }
1327
1305
  var CommandProcessError = class extends Error {
@@ -1341,29 +1319,70 @@ var CommandProcessError = class extends Error {
1341
1319
  function isCommandProcessError(err) {
1342
1320
  return err instanceof CommandProcessError;
1343
1321
  }
1322
+ function hasShellSyntax(str) {
1323
+ return /(\|\||&&|[|&;<>\n])/.test(str);
1324
+ }
1325
+ function resolveCommand(input, useColors = true) {
1326
+ const tokens = (0, shell_quote.parse)(input);
1327
+ const normalized = [];
1328
+ for (const t of tokens) {
1329
+ if (typeof t === "string") {
1330
+ normalized.push(t);
1331
+ continue;
1332
+ }
1333
+ if ("comment" in t) continue;
1334
+ if ("pattern" in t) {
1335
+ normalized.push(t.pattern);
1336
+ continue;
1337
+ }
1338
+ if ("op" in t) throw new Error(formatMessageColor("Unsupported shell operator detected.", useColors));
1339
+ throw new Error(formatMessageColor("Unknown token in command.", useColors));
1340
+ }
1341
+ if (normalized.length === 0) throw new Error(formatMessageColor("Invalid command: empty after parsing.", useColors));
1342
+ const [cmd, ...args] = normalized;
1343
+ if (!cmd) throw new Error(formatMessageColor("Invalid command: empty after parsing.", useColors));
1344
+ return {
1345
+ command: cmd,
1346
+ args
1347
+ };
1348
+ }
1344
1349
  function spawnWithLifecycle(command, args, options, config) {
1345
- const { useColors = true, timeout, forceKill, signal: abortSignal, ...restOption } = options;
1350
+ const { useColors = true, timeout, forceKill, signal: abortSignal, shell = false, ...restOption } = options;
1351
+ let cmd = command;
1352
+ let finalArgs = [...args];
1353
+ const isInline = finalArgs.length === 0 && /\s/.test(cmd);
1346
1354
  const baseStack = (/* @__PURE__ */ new Error()).stack;
1347
- const cmdString = formatCommand(command, args, { useColors });
1348
- const cmdStringPlain = formatCommand(command, args, { useColors: false });
1349
1355
  const formatError = config?.formatError ?? ((msg, meta) => {
1350
1356
  const metaCommand = meta.command.trim();
1351
- const argsString = meta.args.length > 0 ? meta.args.map((a) => require_helper.safeStableStringify(a).trim()).join(" ") : "";
1357
+ const hasArgs = meta.args.length > 0;
1358
+ const argsString = hasArgs ? meta.args.map((a) => require_formatter.safeStableStringify(a).trim()).join(" ") : "";
1359
+ const commandString = hasArgs ? `${metaCommand} ${argsString}` : metaCommand;
1352
1360
  if (meta.useColors) {
1353
- const cmd = require_client.picocolors.magentaBright(metaCommand);
1354
- const args = argsString ? require_client.picocolors.yellowBright(argsString) : "";
1355
- return createProcessError(`${cmd}${args ? " " + args : ""} ${require_client.picocolors.redBright(msg)}`, {
1361
+ const cmd = require_formatter.picocolors.magentaBright(metaCommand);
1362
+ const args = hasArgs ? require_formatter.picocolors.yellowBright(argsString) : "";
1363
+ return createProcessError(`${cmd}${args ? " " + args : ""} ${require_formatter.picocolors.redBright(msg)}`, {
1356
1364
  ...meta,
1357
- command: `${metaCommand} ${argsString}`
1365
+ command: commandString
1358
1366
  }, baseStack);
1359
1367
  }
1360
- return createProcessError(`${metaCommand}${require_helper.isNonEmptyString(argsString) ? " " + argsString : ""} ${msg}`, {
1368
+ return createProcessError(`${commandString} ${msg}`, {
1361
1369
  ...meta,
1362
- command: `${metaCommand} ${argsString}`
1370
+ command: commandString
1363
1371
  }, baseStack);
1364
1372
  });
1365
1373
  const rejectOnNonZero = config?.rejectOnNonZero ?? false;
1366
- const child = (0, node_child_process.spawn)(command, [...args], restOption);
1374
+ if (isInline) {
1375
+ const resolved = resolveCommand(cmd, useColors);
1376
+ cmd = resolved.command;
1377
+ finalArgs = resolved.args;
1378
+ }
1379
+ for (const arg of finalArgs) if (hasShellSyntax(arg)) throw new Error(formatMessageColor(`Invalid argument: "${arg}" contains unsupported shell syntax`, useColors));
1380
+ const cmdString = formatCommand(cmd, finalArgs, { useColors });
1381
+ const cmdStringPlain = formatCommand(cmd, finalArgs, { useColors: false });
1382
+ const child = (0, node_child_process.spawn)(cmd, finalArgs, {
1383
+ shell,
1384
+ ...restOption
1385
+ });
1367
1386
  let finished = false;
1368
1387
  const kill = () => {
1369
1388
  try {
@@ -1388,8 +1407,8 @@ function spawnWithLifecycle(command, args, options, config) {
1388
1407
  kill();
1389
1408
  fail(formatError(`timed out after ${timeout}ms`, {
1390
1409
  reason: "timeout",
1391
- command,
1392
- args,
1410
+ command: cmd,
1411
+ args: finalArgs,
1393
1412
  useColors
1394
1413
  }));
1395
1414
  }, timeout) : null;
@@ -1413,8 +1432,8 @@ function spawnWithLifecycle(command, args, options, config) {
1413
1432
  kill();
1414
1433
  fail(formatError("aborted by signal", {
1415
1434
  reason: "abort",
1416
- command,
1417
- args,
1435
+ command: cmd,
1436
+ args: finalArgs,
1418
1437
  useColors
1419
1438
  }));
1420
1439
  };
@@ -1432,8 +1451,8 @@ function spawnWithLifecycle(command, args, options, config) {
1432
1451
  reason: "signal",
1433
1452
  signal,
1434
1453
  exitCode: code ?? void 0,
1435
- command,
1436
- args,
1454
+ command: cmd,
1455
+ args: finalArgs,
1437
1456
  useColors
1438
1457
  }));
1439
1458
  return;
@@ -1443,8 +1462,8 @@ function spawnWithLifecycle(command, args, options, config) {
1443
1462
  fail(formatError(`exited with code ${exitCode}`, {
1444
1463
  reason: "non-zero exit code",
1445
1464
  exitCode,
1446
- command,
1447
- args,
1465
+ command: cmd,
1466
+ args: finalArgs,
1448
1467
  useColors
1449
1468
  }));
1450
1469
  return;
@@ -1504,7 +1523,7 @@ const VALID_ECMA_VERSION = new Set([
1504
1523
  const REGION_COMMENT_RE = /^#(?:end)?region\b/i;
1505
1524
  const SOURCE_MAP_COMMENT_RE = /^[#@]\s*sourceMappingURL=/;
1506
1525
  function normalizeNewlines(code) {
1507
- return code.replace(/[ \t]+\n/g, require_client.EOL).replace(/\n\s*\n+/g, require_client.EOL);
1526
+ return code.replace(/[ \t]+\n/g, require_formatter.EOL).replace(/\n\s*\n+/g, require_formatter.EOL);
1508
1527
  }
1509
1528
  function stripComments(code, { removeRegion, removeSourceMap, sourceType, ecmaVersion }) {
1510
1529
  const comments = [];
@@ -1570,27 +1589,27 @@ function stripComments(code, { removeRegion, removeSourceMap, sourceType, ecmaVe
1570
1589
  let out = line.replace(/^[ \t]*\/\/\s*(?:\.\.\/|\.\/)*[^ \n]*?(?:src|node_modules)\/[^\n]*\n?/gm, "").replace(/\/\/\s*eslint[^\n]*/g, "");
1571
1590
  out = out.replace(/(\/\/[#@]\s*sourceMappingURL=[^\r\n]*)(?:\r?\n\1)+/g, "$1");
1572
1591
  return out;
1573
- }).join(require_client.EOL);
1592
+ }).join(require_formatter.EOL);
1574
1593
  }
1575
1594
  const commandSjcIdentity = new require_identity.CommandIdentity({ defaultCommandName: "strip-js-comments" });
1576
1595
  const stripJsComments = async (pattern, options = {}) => {
1577
1596
  const loggerLevel = resolveLogVerbosity(options, DEFAULT_SJC_OPTIONS.logLevel);
1578
1597
  try {
1579
1598
  const { patternOptions = DEFAULT_SJC_OPTIONS.patternOptions, removeSourceMap = DEFAULT_SJC_OPTIONS.removeSourceMap, removeRegion = DEFAULT_SJC_OPTIONS.removeRegion, sourceType = DEFAULT_SJC_OPTIONS.sourceType, ecmaVersion = DEFAULT_SJC_OPTIONS.ecmaVersion, __commandTitle } = options;
1580
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_client.joinLinesLoose(require_helper.isNonEmptyString(__commandTitle) ? __commandTitle : commandSjcIdentity.utility(), ""));
1581
- const patterns = [...require_helper.toStringSet(pattern)];
1599
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(require_formatter.joinLinesLoose(require_formatter.isNonEmptyString(__commandTitle) ? __commandTitle : commandSjcIdentity.utility(), ""));
1600
+ const patterns = [...require_formatter.toStringSet(pattern)];
1582
1601
  const cleanPatternOptions = require_server.resolvePatternOptions(patternOptions, DEFAULT_SJC_PATTERN_POLICY);
1583
1602
  if (canLog(loggerLevel, VERBOSE_LOG)) {
1584
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1585
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1586
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_SJC_OPTIONS.patternOptions));
1587
- BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_SJC_OPTIONS.removeSourceMap));
1588
- BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_SJC_OPTIONS.removeRegion));
1589
- BUILD_LOGGER.OPTIONS("options.sourceType", sourceType, BUILD_LOGGER.SOURCE_OF(sourceType, DEFAULT_SJC_OPTIONS.sourceType));
1590
- BUILD_LOGGER.OPTIONS("options.ecmaVersion", ecmaVersion, BUILD_LOGGER.SOURCE_OF(ecmaVersion, DEFAULT_SJC_OPTIONS.ecmaVersion));
1591
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_SJC_OPTIONS.logLevel));
1592
- BUILD_LOGGER.NEW_LINE();
1593
- BUILD_LOGGER.ON_STARTING({ actionName: "Stripping JS Comments" });
1603
+ require_server.BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1604
+ require_server.BUILD_LOGGER.OPTIONS("pattern", patterns, require_server.BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1605
+ require_server.BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, require_server.sourceOfPatternOptions(cleanPatternOptions, DEFAULT_SJC_OPTIONS.patternOptions));
1606
+ require_server.BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, require_server.BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_SJC_OPTIONS.removeSourceMap));
1607
+ require_server.BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, require_server.BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_SJC_OPTIONS.removeRegion));
1608
+ require_server.BUILD_LOGGER.OPTIONS("options.sourceType", sourceType, require_server.BUILD_LOGGER.SOURCE_OF(sourceType, DEFAULT_SJC_OPTIONS.sourceType));
1609
+ require_server.BUILD_LOGGER.OPTIONS("options.ecmaVersion", ecmaVersion, require_server.BUILD_LOGGER.SOURCE_OF(ecmaVersion, DEFAULT_SJC_OPTIONS.ecmaVersion));
1610
+ require_server.BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, require_server.BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_SJC_OPTIONS.logLevel));
1611
+ require_server.BUILD_LOGGER.NEW_LINE();
1612
+ require_server.BUILD_LOGGER.ON_STARTING({ actionName: "Stripping JS Comments" });
1594
1613
  }
1595
1614
  const files = (await require_server.fastGlob(patterns, cleanPatternOptions)).sort();
1596
1615
  let count = 0;
@@ -1611,7 +1630,7 @@ const stripJsComments = async (pattern, options = {}) => {
1611
1630
  sourceType,
1612
1631
  ecmaVersion
1613
1632
  });
1614
- output = normalizeNewlines(output).trim() + require_client.EOL;
1633
+ output = normalizeNewlines(output).trim() + require_formatter.EOL;
1615
1634
  if (output !== content) {
1616
1635
  try {
1617
1636
  await require_server.fsExtra.promises.writeFile(filePath, output, "utf8");
@@ -1620,24 +1639,24 @@ const stripJsComments = async (pattern, options = {}) => {
1620
1639
  throw err;
1621
1640
  }
1622
1641
  count++;
1623
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
1642
+ if (canLog(loggerLevel, VERBOSE_LOG)) require_server.BUILD_LOGGER.ON_PROCESS({
1624
1643
  actionName: "JS Comment Stripping",
1625
1644
  count,
1626
1645
  nameDirect: filePath
1627
1646
  });
1628
1647
  }
1629
1648
  }
1630
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
1649
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) require_server.BUILD_LOGGER.ON_FINISH({
1631
1650
  actionName: "Stripping JS Comments",
1632
1651
  count
1633
1652
  });
1634
- else BUILD_LOGGER.ON_SKIPPING({
1653
+ else require_server.BUILD_LOGGER.ON_SKIPPING({
1635
1654
  actionName: "Stripping JS Comments",
1636
1655
  reasonType: "file",
1637
1656
  reasonEndText: "processing"
1638
1657
  });
1639
1658
  } catch (error) {
1640
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
1659
+ if (loggerLevel !== "silent") require_server.BUILD_LOGGER.ON_ERROR({
1641
1660
  actionName: "Stripping JS Comments",
1642
1661
  error
1643
1662
  });