@powerlines/core 0.44.9 → 0.44.11
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.
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/lib/config.d.cts +2 -2
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +2 -2
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +1 -1
- package/dist/lib/unplugin/plugin.mjs +1 -1
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +2 -2
- package/dist/plugin-utils/logging.cjs +122 -20
- package/dist/plugin-utils/logging.d.cts +12 -4
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +12 -4
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +122 -21
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/types/api.d.cts +11 -4
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +11 -4
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +8 -10
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +8 -10
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +7 -7
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +7 -7
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/logging.d.cts +1 -1
- package/dist/types/logging.d.cts.map +1 -1
- package/dist/types/logging.d.mts +1 -1
- package/dist/types/logging.d.mts.map +1 -1
- package/dist/types/logging.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/plugin-utils/logging.ts"],"mappings":";;;;;;AA2DA;;;;;iBAAgB,SAAA,CAAU,QAAA;;;;;AAiC1B;;iBAzBgB,SAAA,CAAU,OAAA,EAAS,iBAAA;;;;;;;;iBAyBnB,eAAA,CACd,QAAA,GAAW,kBAAA,EACX,IAAA,GAAO,IAAA,GACN,sBAAA;;;;;AA2FH;;cAAa,YAAA,GAAgB,IAAA;;;AAiB7B;;;;cAAa,SAAA,GAAa,IAAA;AAY1B;;;;;AAMA;AANA,cAAa,eAAA,GAAmB,IAAA;AAAA,cAMnB,UAAA,GAAc,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,iBA0C7B,eAAA,CAAgB,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAA;AAAA,iBAQ1C,qBAAA,CACd,IAAA,EAAM,QAAA,EACN,QAAA,EAAU,sBAAA,EACV,QAAA,GAAU,WAAA;;;;;AAXZ;;;cAuBa,WAAA,GAAe,IAAA,UAAc,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AAflE;cA2Ja,UAAA,GAAc,MAAA,EAAQ,MAAA,EAAQ,eAAA,EAAiB,MAAA,KAAS,MAAA;;;;;;;;cAuFxD,gBAAA,GACX,MAAA,EAAQ,MAAA,EACR,YAAA,EAAc,YAAA,KACb,MAAA;AAAA,cAoEU,aAAA,
|
|
1
|
+
{"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/plugin-utils/logging.ts"],"mappings":";;;;;;AA2DA;;;;;iBAAgB,SAAA,CAAU,QAAA;;;;;AAiC1B;;iBAzBgB,SAAA,CAAU,OAAA,EAAS,iBAAA;;;;;;;;iBAyBnB,eAAA,CACd,QAAA,GAAW,kBAAA,EACX,IAAA,GAAO,IAAA,GACN,sBAAA;;;;;AA2FH;;cAAa,YAAA,GAAgB,IAAA;;;AAiB7B;;;;cAAa,SAAA,GAAa,IAAA;AAY1B;;;;;AAMA;AANA,cAAa,eAAA,GAAmB,IAAA;AAAA,cAMnB,UAAA,GAAc,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,iBA0C7B,eAAA,CAAgB,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAA;AAAA,iBAQ1C,qBAAA,CACd,IAAA,EAAM,QAAA,EACN,QAAA,EAAU,sBAAA,EACV,QAAA,GAAU,WAAA;;;;;AAXZ;;;cAuBa,WAAA,GAAe,IAAA,UAAc,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AAflE;cA2Ja,UAAA,GAAc,MAAA,EAAQ,MAAA,EAAQ,eAAA,EAAiB,MAAA,KAAS,MAAA;;;;;;;;cAuFxD,SAAA,GAAa,MAAA,EAAQ,MAAA,EAAQ,KAAA,EAAO,KAAA,KAAQ,MAAA;;;;;;;AAnOzD;cA0Wa,gBAAA,GACX,MAAA,EAAQ,MAAA,EACR,YAAA,EAAc,YAAA,KACb,MAAA;AAAA,cAoEU,aAAA,EAAe,KAAA;;;;;;;;cAmBf,YAAA,GACX,IAAA,UACA,OAAA,EAAS,aAAA,EACT,QAAA,GAAU,KAAA,KACT,MAAA;;;;;;;;cAuDU,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AA5RlE;cAkTa,YAAA,GACX,MAAA,EAAQ,MAAA,EACR,OAAA,EAAS,aAAA,KACR,MAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomLogger, LogCategory, LogFn, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMeta, Logger,
|
|
1
|
+
import { CustomLogger, LogCategory, LogFn, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMeta, Logger, LoggerOptions } from "../types/logging.mjs";
|
|
2
2
|
import { UnresolvedContext } from "../types/context.mjs";
|
|
3
3
|
import { Mode } from "../types/config.mjs";
|
|
4
4
|
|
|
@@ -65,6 +65,14 @@ declare const createLogFn: (name: string, options: LogFnOptions) => LogFn;
|
|
|
65
65
|
* @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
66
66
|
*/
|
|
67
67
|
declare const withLogger: (logger: Logger, secondaryLogger: Logger) => Logger;
|
|
68
|
+
/**
|
|
69
|
+
* Create a logging function with a specific name and options.
|
|
70
|
+
*
|
|
71
|
+
* @param logger - The original logger to wrap with the custom logger.
|
|
72
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
73
|
+
* @returns A new logger that combines the original logger's options with the custom logging function, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
74
|
+
*/
|
|
75
|
+
declare const withLogFn: (logger: Logger, logFn: LogFn) => Logger;
|
|
68
76
|
/**
|
|
69
77
|
* Create a logging function with a specific name and options.
|
|
70
78
|
*
|
|
@@ -73,7 +81,7 @@ declare const withLogger: (logger: Logger, secondaryLogger: Logger) => Logger;
|
|
|
73
81
|
* @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
74
82
|
*/
|
|
75
83
|
declare const withCustomLogger: (logger: Logger, customLogger: CustomLogger) => Logger;
|
|
76
|
-
declare const consoleLogger:
|
|
84
|
+
declare const consoleLogger: LogFn;
|
|
77
85
|
/**
|
|
78
86
|
* Create a logging function with a specific name and options.
|
|
79
87
|
*
|
|
@@ -81,7 +89,7 @@ declare const consoleLogger: (type: LogLevel, message: string | LoggerMessage) =
|
|
|
81
89
|
* @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.
|
|
82
90
|
* @returns A logging function.
|
|
83
91
|
*/
|
|
84
|
-
declare const createLogger: (name: string, options: LoggerOptions, callback?:
|
|
92
|
+
declare const createLogger: (name: string, options: LoggerOptions, callback?: LogFn) => Logger;
|
|
85
93
|
/**
|
|
86
94
|
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
87
95
|
*
|
|
@@ -99,5 +107,5 @@ declare const extendLogFn: (logFn: LogFn, options: LogFnOptions) => LogFn;
|
|
|
99
107
|
*/
|
|
100
108
|
declare const extendLogger: (logger: Logger, options: LoggerOptions) => Logger;
|
|
101
109
|
//#endregion
|
|
102
|
-
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger };
|
|
110
|
+
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
103
111
|
//# sourceMappingURL=logging.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.d.mts","names":[],"sources":["../../src/plugin-utils/logging.ts"],"mappings":";;;;;;AA2DA;;;;;iBAAgB,SAAA,CAAU,QAAA;;;;;AAiC1B;;iBAzBgB,SAAA,CAAU,OAAA,EAAS,iBAAA;;;;;;;;iBAyBnB,eAAA,CACd,QAAA,GAAW,kBAAA,EACX,IAAA,GAAO,IAAA,GACN,sBAAA;;;;;AA2FH;;cAAa,YAAA,GAAgB,IAAA;;;AAiB7B;;;;cAAa,SAAA,GAAa,IAAA;AAY1B;;;;;AAMA;AANA,cAAa,eAAA,GAAmB,IAAA;AAAA,cAMnB,UAAA,GAAc,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,iBA0C7B,eAAA,CAAgB,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAA;AAAA,iBAQ1C,qBAAA,CACd,IAAA,EAAM,QAAA,EACN,QAAA,EAAU,sBAAA,EACV,QAAA,GAAU,WAAA;;;;;AAXZ;;;cAuBa,WAAA,GAAe,IAAA,UAAc,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AAflE;cA2Ja,U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A;;;;;;;;cAuDU,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AA5RlE;cAkTa,YAAA,GACX,MAAA,EAAQ,MAAA,EACR,OAAA,EAAS,aAAA,KACR,MAAA"}
|
|
@@ -128,7 +128,7 @@ const colorBackground = (text) => {
|
|
|
128
128
|
const title = titleCase(text);
|
|
129
129
|
return chalk.inverse.hex(getTextColor(title))(` ${title} `);
|
|
130
130
|
};
|
|
131
|
-
const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.category === LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.name ? chalk.grey(" > ") : ""}${meta.command
|
|
131
|
+
const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.category === LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.name ? chalk.grey(" > ") : ""}${meta.command ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.command))}${chalk.grey(" > ")}` : ""}${meta.environment && kebabCase(meta.environment) !== "default" ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.environment))}${chalk.grey(" > ")}` : ""}${meta.plugin ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.plugin))}${chalk.grey(" > ")}` : ""}${meta.source ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.source))}${chalk.grey(" > ")}` : ""}${meta.category && meta.category !== LogCategories.GENERAL && meta.category !== LogCategories.PERFORMANCE ? `${colorBackground(kebabCase(meta.category))} ` : ""}${args.join(" ")} `.trim());
|
|
132
132
|
function isValidLogLevel(logLevel, type) {
|
|
133
133
|
if (logLevel === LogLevels.SILENT) return false;
|
|
134
134
|
return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);
|
|
@@ -204,12 +204,12 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
|
|
|
204
204
|
name,
|
|
205
205
|
plugin: options.plugin,
|
|
206
206
|
meta: {
|
|
207
|
+
category: LogCategories.GENERAL,
|
|
208
|
+
...options,
|
|
207
209
|
type,
|
|
208
210
|
name,
|
|
209
|
-
category: LogCategories.GENERAL,
|
|
210
211
|
logId: uuid(),
|
|
211
|
-
timestamp: Date.now()
|
|
212
|
-
...options
|
|
212
|
+
timestamp: Date.now()
|
|
213
213
|
},
|
|
214
214
|
message
|
|
215
215
|
} : {
|
|
@@ -217,13 +217,13 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
|
|
|
217
217
|
plugin: options.plugin,
|
|
218
218
|
...message,
|
|
219
219
|
meta: {
|
|
220
|
+
category: LogCategories.GENERAL,
|
|
221
|
+
...options,
|
|
220
222
|
type,
|
|
221
223
|
name,
|
|
222
|
-
category: LogCategories.GENERAL,
|
|
223
224
|
logId: uuid(),
|
|
224
225
|
timestamp: Date.now(),
|
|
225
226
|
plugin: message.plugin,
|
|
226
|
-
...options,
|
|
227
227
|
...message.meta
|
|
228
228
|
}
|
|
229
229
|
};
|
|
@@ -297,6 +297,97 @@ const withLogger = (logger, secondaryLogger) => {
|
|
|
297
297
|
* Create a logging function with a specific name and options.
|
|
298
298
|
*
|
|
299
299
|
* @param logger - The original logger to wrap with the custom logger.
|
|
300
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
301
|
+
* @returns A new logger that combines the original logger's options with the custom logging function, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
302
|
+
*/
|
|
303
|
+
const withLogFn = (logger, logFn) => {
|
|
304
|
+
const result = {
|
|
305
|
+
options: logger.options,
|
|
306
|
+
error: validateLogger("error", logger.options.name, logger.options, (msg) => {
|
|
307
|
+
logger.error?.(msg);
|
|
308
|
+
logFn({
|
|
309
|
+
category: LogCategories.GENERAL,
|
|
310
|
+
...logger.options,
|
|
311
|
+
type: "error",
|
|
312
|
+
logId: uuid(),
|
|
313
|
+
timestamp: Date.now(),
|
|
314
|
+
...msg.meta
|
|
315
|
+
}, msg.message);
|
|
316
|
+
}),
|
|
317
|
+
warn: validateLogger("warn", logger.options.name, logger.options, (msg) => {
|
|
318
|
+
logger.warn?.(msg);
|
|
319
|
+
logFn({
|
|
320
|
+
category: LogCategories.GENERAL,
|
|
321
|
+
...logger.options,
|
|
322
|
+
type: "warn",
|
|
323
|
+
logId: uuid(),
|
|
324
|
+
timestamp: Date.now(),
|
|
325
|
+
...msg.meta
|
|
326
|
+
}, msg.message);
|
|
327
|
+
}),
|
|
328
|
+
info: validateLogger("info", logger.options.name, logger.options, (msg) => {
|
|
329
|
+
logger.info?.(msg);
|
|
330
|
+
logFn({
|
|
331
|
+
category: LogCategories.GENERAL,
|
|
332
|
+
...logger.options,
|
|
333
|
+
type: "info",
|
|
334
|
+
logId: uuid(),
|
|
335
|
+
timestamp: Date.now(),
|
|
336
|
+
...msg.meta
|
|
337
|
+
}, msg.message);
|
|
338
|
+
}),
|
|
339
|
+
debug: validateLogger("debug", logger.options.name, logger.options, (msg) => {
|
|
340
|
+
logger.debug?.(msg);
|
|
341
|
+
logFn({
|
|
342
|
+
category: LogCategories.GENERAL,
|
|
343
|
+
...logger.options,
|
|
344
|
+
type: "debug",
|
|
345
|
+
logId: uuid(),
|
|
346
|
+
timestamp: Date.now(),
|
|
347
|
+
...msg.meta
|
|
348
|
+
}, msg.message);
|
|
349
|
+
}),
|
|
350
|
+
trace: validateLogger("trace", logger.options.name, logger.options, (msg) => {
|
|
351
|
+
logger.trace?.(msg);
|
|
352
|
+
logFn({
|
|
353
|
+
category: LogCategories.GENERAL,
|
|
354
|
+
...logger.options,
|
|
355
|
+
type: "trace",
|
|
356
|
+
logId: uuid(),
|
|
357
|
+
timestamp: Date.now(),
|
|
358
|
+
...msg.meta
|
|
359
|
+
}, msg.message);
|
|
360
|
+
})
|
|
361
|
+
};
|
|
362
|
+
result.log = (type, message) => {
|
|
363
|
+
switch (type) {
|
|
364
|
+
case "error":
|
|
365
|
+
result.error(message);
|
|
366
|
+
break;
|
|
367
|
+
case "warn":
|
|
368
|
+
result.warn(message);
|
|
369
|
+
break;
|
|
370
|
+
case "info":
|
|
371
|
+
result.info(message);
|
|
372
|
+
break;
|
|
373
|
+
case "debug":
|
|
374
|
+
result.debug(message);
|
|
375
|
+
break;
|
|
376
|
+
case "trace":
|
|
377
|
+
result.trace(message);
|
|
378
|
+
break;
|
|
379
|
+
case "silent": break;
|
|
380
|
+
default:
|
|
381
|
+
result.info(message);
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
return result;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Create a logging function with a specific name and options.
|
|
389
|
+
*
|
|
390
|
+
* @param logger - The original logger to wrap with the custom logger.
|
|
300
391
|
* @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
301
392
|
* @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
302
393
|
*/
|
|
@@ -334,18 +425,13 @@ const withCustomLogger = (logger, customLogger) => {
|
|
|
334
425
|
};
|
|
335
426
|
return result;
|
|
336
427
|
};
|
|
337
|
-
const consoleLogger = (
|
|
338
|
-
type,
|
|
339
|
-
category: LogCategories.GENERAL,
|
|
340
|
-
logId: uuid(),
|
|
341
|
-
timestamp: Date.now()
|
|
342
|
-
} : {
|
|
343
|
-
type,
|
|
428
|
+
const consoleLogger = (meta, message) => consoleLog({
|
|
429
|
+
type: isSetString(meta) ? meta : meta.type,
|
|
344
430
|
category: LogCategories.GENERAL,
|
|
345
431
|
logId: uuid(),
|
|
346
432
|
timestamp: Date.now(),
|
|
347
|
-
...
|
|
348
|
-
},
|
|
433
|
+
...isSetObject(meta) ? meta : {}
|
|
434
|
+
}, message);
|
|
349
435
|
/**
|
|
350
436
|
* Create a logging function with a specific name and options.
|
|
351
437
|
*
|
|
@@ -362,23 +448,38 @@ const createLogger = (name, options, callback = consoleLogger) => {
|
|
|
362
448
|
error: validateLogger("error", name, {
|
|
363
449
|
...options,
|
|
364
450
|
name
|
|
365
|
-
}, (
|
|
451
|
+
}, (data) => callback({
|
|
452
|
+
...data.meta,
|
|
453
|
+
type: "error"
|
|
454
|
+
}, data.message)),
|
|
366
455
|
warn: validateLogger("warn", name, {
|
|
367
456
|
...options,
|
|
368
457
|
name
|
|
369
|
-
}, (
|
|
458
|
+
}, (data) => callback({
|
|
459
|
+
...data.meta,
|
|
460
|
+
type: "warn"
|
|
461
|
+
}, data.message)),
|
|
370
462
|
info: validateLogger("info", name, {
|
|
371
463
|
...options,
|
|
372
464
|
name
|
|
373
|
-
}, (
|
|
465
|
+
}, (data) => callback({
|
|
466
|
+
...data.meta,
|
|
467
|
+
type: "info"
|
|
468
|
+
}, data.message)),
|
|
374
469
|
debug: validateLogger("debug", name, {
|
|
375
470
|
...options,
|
|
376
471
|
name
|
|
377
|
-
}, (
|
|
472
|
+
}, (data) => callback({
|
|
473
|
+
...data.meta,
|
|
474
|
+
type: "debug"
|
|
475
|
+
}, data.message)),
|
|
378
476
|
trace: validateLogger("trace", name, {
|
|
379
477
|
...options,
|
|
380
478
|
name
|
|
381
|
-
}, (
|
|
479
|
+
}, (data) => callback({
|
|
480
|
+
...data.meta,
|
|
481
|
+
type: "trace"
|
|
482
|
+
}, data.message))
|
|
382
483
|
};
|
|
383
484
|
result.log = (type, message) => {
|
|
384
485
|
switch (type) {
|
|
@@ -468,5 +569,5 @@ const extendLogger = (logger, options) => {
|
|
|
468
569
|
};
|
|
469
570
|
|
|
470
571
|
//#endregion
|
|
471
|
-
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger };
|
|
572
|
+
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
472
573
|
//# sourceMappingURL=logging.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nconst BRAND_COLOR = getColor(\"brand\");\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const getTextColor = (text: string): string => {\n return (\n BADGE_COLORS[\n text\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n );\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorText = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.hex(getTextColor(title))(title);\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorBackground = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.inverse.hex(getTextColor(title))(` ${title} `);\n};\n\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(\n getLogLevel(\n meta.category === LogCategories.PERFORMANCE ? \"performance\" : meta.type\n ),\n {\n logLevel: \"all\"\n }\n )(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${meta.name ? chalk.grey(\" > \") : \"\"}${\n meta.command && kebabCase(meta.command)\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.command)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.plugin\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.source\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category &&\n meta.category !== LogCategories.GENERAL &&\n meta.category !== LogCategories.PERFORMANCE\n ? `${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogFn = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n logMeta.$$ipc ||\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: string | LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n const result = {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n const result = {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\nexport const consoleLogger = (\n type: LogLevel,\n message: string | LoggerMessage\n) =>\n consoleLog(\n isSetString(message)\n ? {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now()\n }\n : {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...message.meta\n },\n isSetString(message) ? message : message.message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogger = (\n name: string,\n options: LoggerOptions,\n callback: (\n type: LogLevel,\n message: string | LoggerMessage\n ) => void = consoleLogger\n): Logger => {\n const result = {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, message =>\n callback(\"error\", message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, message =>\n callback(\"warn\", message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, message =>\n callback(\"info\", message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, message =>\n callback(\"debug\", message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, message =>\n callback(\"trace\", message)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Extend a logging function with a specific name, adding a colored badge to the log output.\n *\n * @param logFn - The original logging function to extend.\n * @param options - The overlay metadata to use for the badge in the log output.\n * @returns A new logging function that includes the badge in its output.\n */\nexport const extendLogFn = (logFn: LogFn, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n const result = {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,MAAM,QAAQ,SAAS,kBAAkB,GACrC,oBACA,kBAAkB,OAAO;AAE7B,QAAO,UAAU,WAAW,UAAU;;;;;;;;;AAUxC,SAAgB,gBACd,UACA,MACwB;AACxB,KAAI,aAAa,QACf,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;CAGH,IAAI;AACJ,KAAI,SAAS,cACX,mBAAkB;UACT,SAAS,OAClB,mBAAkB;KAElB,mBAAkB;AAGpB,KAAI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AAK,OAAO,CAAC;EACvE,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC1E,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC3E;AAED,QAAO,OAAO,MAAgB,YAAoC;AAChE,UAAQ,MAAR;GACE,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK,SACH;GACF;AACE,WAAO,KAAK,QAAQ;AACpB;;;AAIN,QAAO"}
|
|
1
|
+
{"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nconst BRAND_COLOR = getColor(\"brand\");\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const getTextColor = (text: string): string => {\n return (\n BADGE_COLORS[\n text\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n );\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorText = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.hex(getTextColor(title))(title);\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorBackground = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.inverse.hex(getTextColor(title))(` ${title} `);\n};\n\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(\n getLogLevel(\n meta.category === LogCategories.PERFORMANCE ? \"performance\" : meta.type\n ),\n {\n logLevel: \"all\"\n }\n )(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${meta.name ? chalk.grey(\" > \") : \"\"}${\n meta.command\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.command)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.plugin\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.source\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category &&\n meta.category !== LogCategories.GENERAL &&\n meta.category !== LogCategories.PERFORMANCE\n ? `${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogFn = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n logMeta.$$ipc ||\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n category: LogCategories.GENERAL,\n ...options,\n type,\n name,\n logId: uuid(),\n timestamp: Date.now()\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n category: LogCategories.GENERAL,\n ...options,\n type,\n name,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...message.meta\n }\n };\n\n if (\n params.meta.$$ipc ||\n isValidLogLevelConfig(type, logLevel, params.meta.category)\n ) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n const result = {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logging function, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogFn = (logger: Logger, logFn: LogFn): Logger => {\n const result = {\n options: logger.options,\n error: validateLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n (msg: LoggerMessage) => {\n logger.error?.(msg);\n logFn(\n {\n category: LogCategories.GENERAL,\n ...logger.options,\n type: \"error\",\n logId: uuid(),\n timestamp: Date.now(),\n ...msg.meta\n },\n msg.message\n );\n }\n ),\n warn: validateLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n (msg: LoggerMessage) => {\n logger.warn?.(msg);\n logFn(\n {\n category: LogCategories.GENERAL,\n ...logger.options,\n type: \"warn\",\n logId: uuid(),\n timestamp: Date.now(),\n ...msg.meta\n },\n msg.message\n );\n }\n ),\n info: validateLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n (msg: LoggerMessage) => {\n logger.info?.(msg);\n logFn(\n {\n category: LogCategories.GENERAL,\n ...logger.options,\n type: \"info\",\n logId: uuid(),\n timestamp: Date.now(),\n ...msg.meta\n },\n msg.message\n );\n }\n ),\n debug: validateLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n (msg: LoggerMessage) => {\n logger.debug?.(msg);\n logFn(\n {\n category: LogCategories.GENERAL,\n ...logger.options,\n type: \"debug\",\n logId: uuid(),\n timestamp: Date.now(),\n ...msg.meta\n },\n msg.message\n );\n }\n ),\n trace: validateLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n (msg: LoggerMessage) => {\n logger.trace?.(msg);\n logFn(\n {\n category: LogCategories.GENERAL,\n ...logger.options,\n type: \"trace\",\n logId: uuid(),\n timestamp: Date.now(),\n ...msg.meta\n },\n msg.message\n );\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n const result = {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\nexport const consoleLogger: LogFn = (meta: LogFnMeta, message: string) =>\n consoleLog(\n {\n type: isSetString(meta) ? meta : meta.type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...(isSetObject(meta) ? meta : {})\n },\n message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogger = (\n name: string,\n options: LoggerOptions,\n callback: LogFn = consoleLogger\n): Logger => {\n const result = {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, data =>\n callback({ ...data.meta, type: \"error\" }, data.message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, data =>\n callback({ ...data.meta, type: \"warn\" }, data.message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, data =>\n callback({ ...data.meta, type: \"info\" }, data.message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, data =>\n callback({ ...data.meta, type: \"debug\" }, data.message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, data =>\n callback({ ...data.meta, type: \"trace\" }, data.message)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Extend a logging function with a specific name, adding a colored badge to the log output.\n *\n * @param logFn - The original logging function to extend.\n * @param options - The overlay metadata to use for the badge in the log output.\n * @returns A new logging function that includes the badge in its output.\n */\nexport const extendLogFn = (logFn: LogFn, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n const result = {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,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H,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK,SACH;GACF;AACE,WAAO,KAAK,QAAQ;AACpB;;;AAIN,QAAO"}
|
package/dist/types/api.d.cts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { POWERLINES_API_FUNCTIONS } from "../constants/api.cjs";
|
|
1
|
+
import { BASE_API_FUNCTIONS, POWERLINES_API_FUNCTIONS } from "../constants/api.cjs";
|
|
2
|
+
import { SUPPORTED_COMMANDS } from "../constants/commands.cjs";
|
|
2
3
|
import { WorkerProcess } from "./utils.cjs";
|
|
3
4
|
import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.cjs";
|
|
4
5
|
import { EngineContext, EnvironmentContext, ExecutionContext, PluginContext } from "./context.cjs";
|
|
5
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig,
|
|
6
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ExecutionOptions, InlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "./config.cjs";
|
|
6
7
|
|
|
7
8
|
//#region src/types/api.d.ts
|
|
9
|
+
type BaseAPIFunctions = (typeof BASE_API_FUNCTIONS)[number];
|
|
10
|
+
type APIFunctions = (typeof POWERLINES_API_FUNCTIONS)[number];
|
|
11
|
+
type SupportedCommands = (typeof SUPPORTED_COMMANDS)[number];
|
|
8
12
|
/**
|
|
9
13
|
* The Powerlines Base API Interface
|
|
10
14
|
*
|
|
@@ -130,7 +134,7 @@ interface ExecutionWorkerParams {
|
|
|
130
134
|
/**
|
|
131
135
|
* The execution options for the current execution instance
|
|
132
136
|
*/
|
|
133
|
-
options:
|
|
137
|
+
options: ExecutionOptions;
|
|
134
138
|
/**
|
|
135
139
|
* The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
|
|
136
140
|
*/
|
|
@@ -146,11 +150,14 @@ interface Engine extends Execution {
|
|
|
146
150
|
*/
|
|
147
151
|
context: EngineContext;
|
|
148
152
|
}
|
|
153
|
+
declare type __ΩBaseAPIFunctions = any[];
|
|
154
|
+
declare type __ΩAPIFunctions = any[];
|
|
155
|
+
declare type __ΩSupportedCommands = any[];
|
|
149
156
|
declare type __ΩExecution = any[];
|
|
150
157
|
declare type __ΩAPI = any[];
|
|
151
158
|
declare type __ΩExecutionWorkerParams = any[];
|
|
152
159
|
declare type __ΩExecutionWorkerProcess = any[];
|
|
153
160
|
declare type __ΩEngine = any[];
|
|
154
161
|
//#endregion
|
|
155
|
-
export { API, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, __ΩAPI, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess };
|
|
162
|
+
export { API, APIFunctions, BaseAPIFunctions, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, SupportedCommands, __ΩAPI, __ΩAPIFunctions, __ΩBaseAPIFunctions, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩSupportedCommands };
|
|
156
163
|
//# sourceMappingURL=api.d.cts.map
|
package/dist/types/api.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.cts","names":[],"sources":["../../src/types/api.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"api.d.cts","names":[],"sources":["../../src/types/api.ts"],"mappings":";;;;;;;;KA+CY,gBAAA,WAA2B,kBAAA;AAAA,KAC3B,YAAA,WAAuB,wBAAA;AAAA,KACvB,iBAAA,WAA4B,kBAAA;;;;AADxC;;;UASiB,SAAA;EAT0C;AAC3D;;;;;AAQA;;EASE,OAAA,GACE,YAAA,EACI,mBA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,SAAA;EAxB5B;;;EA4BF,OAAA,EAAS,aAAA;AAAA;AAAA"}
|
package/dist/types/api.d.mts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { POWERLINES_API_FUNCTIONS } from "../constants/api.mjs";
|
|
1
|
+
import { BASE_API_FUNCTIONS, POWERLINES_API_FUNCTIONS } from "../constants/api.mjs";
|
|
2
|
+
import { SUPPORTED_COMMANDS } from "../constants/commands.mjs";
|
|
2
3
|
import { WorkerProcess } from "./utils.mjs";
|
|
3
4
|
import { CallHookOptions, InferHookParameters, InferHookReturnType } from "./hooks.mjs";
|
|
4
5
|
import { EngineContext, EnvironmentContext, ExecutionContext, PluginContext } from "./context.mjs";
|
|
5
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, InlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig,
|
|
6
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, ExecutionOptions, InlineConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "./config.mjs";
|
|
6
7
|
|
|
7
8
|
//#region src/types/api.d.ts
|
|
9
|
+
type BaseAPIFunctions = (typeof BASE_API_FUNCTIONS)[number];
|
|
10
|
+
type APIFunctions = (typeof POWERLINES_API_FUNCTIONS)[number];
|
|
11
|
+
type SupportedCommands = (typeof SUPPORTED_COMMANDS)[number];
|
|
8
12
|
/**
|
|
9
13
|
* The Powerlines Base API Interface
|
|
10
14
|
*
|
|
@@ -130,7 +134,7 @@ interface ExecutionWorkerParams {
|
|
|
130
134
|
/**
|
|
131
135
|
* The execution options for the current execution instance
|
|
132
136
|
*/
|
|
133
|
-
options:
|
|
137
|
+
options: ExecutionOptions;
|
|
134
138
|
/**
|
|
135
139
|
* The inline configuration for the current execution instance, which is the result of merging the user configuration with any configuration provided by plugins during the "config" hook.
|
|
136
140
|
*/
|
|
@@ -146,11 +150,14 @@ interface Engine extends Execution {
|
|
|
146
150
|
*/
|
|
147
151
|
context: EngineContext;
|
|
148
152
|
}
|
|
153
|
+
declare type __ΩBaseAPIFunctions = any[];
|
|
154
|
+
declare type __ΩAPIFunctions = any[];
|
|
155
|
+
declare type __ΩSupportedCommands = any[];
|
|
149
156
|
declare type __ΩExecution = any[];
|
|
150
157
|
declare type __ΩAPI = any[];
|
|
151
158
|
declare type __ΩExecutionWorkerParams = any[];
|
|
152
159
|
declare type __ΩExecutionWorkerProcess = any[];
|
|
153
160
|
declare type __ΩEngine = any[];
|
|
154
161
|
//#endregion
|
|
155
|
-
export { API, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, __ΩAPI, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess };
|
|
162
|
+
export { API, APIFunctions, BaseAPIFunctions, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, SupportedCommands, __ΩAPI, __ΩAPIFunctions, __ΩBaseAPIFunctions, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩSupportedCommands };
|
|
156
163
|
//# sourceMappingURL=api.d.mts.map
|
package/dist/types/api.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","names":[],"sources":["../../src/types/api.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"api.d.mts","names":[],"sources":["../../src/types/api.ts"],"mappings":";;;;;;;;KA+CY,gBAAA,WAA2B,kBAAA;AAAA,KAC3B,YAAA,WAAuB,wBAAA;AAAA,KACvB,iBAAA,WAA4B,kBAAA;;;;AADxC;;;UASiB,SAAA;EAT0C;AAC3D;;;;;AAQA;;EASE,OAAA,GACE,YAAA,EACI,mBAAA,GACA,eAAA,GACA,iBAAA,GACA,iBAAA,GACA,gBAAA,GACA,gBAAA,GACA,kBAAA,KACD,OAAA;EAPC;;;;;;;;EAiBN,KAAA,GAAQ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tsconfig.cjs";
|
|
|
5
5
|
import { PluginContext } from "./context.cjs";
|
|
6
6
|
import { Format } from "@storm-software/build-tools/types";
|
|
7
7
|
import { StormWorkspaceConfig } from "@storm-software/config/types";
|
|
8
|
-
import { DeepPartial, MaybePromise, NonUndefined,
|
|
8
|
+
import { DeepPartial, MaybePromise, NonUndefined, RequiredKeys } from "@stryke/types/base";
|
|
9
9
|
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
10
10
|
import { AssetGlob } from "@stryke/types/file";
|
|
11
11
|
import { ConfigLayer, ResolvedConfig } from "c12";
|
|
@@ -233,7 +233,7 @@ interface OutputConfig {
|
|
|
233
233
|
*/
|
|
234
234
|
storage?: StoragePort | StoragePreset;
|
|
235
235
|
}
|
|
236
|
-
interface
|
|
236
|
+
interface EngineInputOptions {
|
|
237
237
|
/**
|
|
238
238
|
* The name of the project
|
|
239
239
|
*/
|
|
@@ -241,7 +241,7 @@ interface EngineOptions {
|
|
|
241
241
|
/**
|
|
242
242
|
* The root directory of the project
|
|
243
243
|
*/
|
|
244
|
-
root
|
|
244
|
+
root?: string;
|
|
245
245
|
/**
|
|
246
246
|
* The current working directory the Powerlines processes should operate in
|
|
247
247
|
*
|
|
@@ -263,7 +263,7 @@ interface EngineOptions {
|
|
|
263
263
|
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
264
264
|
*
|
|
265
265
|
* @remarks
|
|
266
|
-
* If no values are provided for {@link OutputConfig.
|
|
266
|
+
* If no values are provided for {@link OutputConfig.types | output.types} or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
|
|
267
267
|
*
|
|
268
268
|
* @defaultValue "powerlines"
|
|
269
269
|
*/
|
|
@@ -280,7 +280,7 @@ interface EngineOptions {
|
|
|
280
280
|
*/
|
|
281
281
|
configFile?: string;
|
|
282
282
|
}
|
|
283
|
-
type
|
|
283
|
+
type EngineOptions = RequiredKeys<EngineInputOptions, "root" | "cwd" | "framework">;
|
|
284
284
|
interface ExecutionOptions extends EngineOptions {
|
|
285
285
|
/**
|
|
286
286
|
* A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
@@ -291,7 +291,6 @@ interface ExecutionOptions extends EngineOptions {
|
|
|
291
291
|
*/
|
|
292
292
|
executionIndex: number;
|
|
293
293
|
}
|
|
294
|
-
type ResolvedExecutionOptions = Pick<ExecutionOptions, "executionIndex" | "executionId"> & ResolvedEngineOptions;
|
|
295
294
|
interface Config {
|
|
296
295
|
/**
|
|
297
296
|
* Defines entries and location(s) of entry modules for the bundle. Relative paths are resolved based on the `root` option.
|
|
@@ -553,7 +552,7 @@ type DeployInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineCon
|
|
|
553
552
|
*/
|
|
554
553
|
command: "deploy";
|
|
555
554
|
};
|
|
556
|
-
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (params:
|
|
555
|
+
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (params: EngineOptions) => MaybePromise<TUserConfig>;
|
|
557
556
|
type AnyOutputUserConfig = Partial<Omit<OutputConfig, "copy">> & {
|
|
558
557
|
/**
|
|
559
558
|
* The output configuration options to use for the build process
|
|
@@ -691,10 +690,9 @@ declare type __ΩMode = any[];
|
|
|
691
690
|
declare type __ΩResolveConfig = any[];
|
|
692
691
|
declare type __ΩCopyConfig = any[];
|
|
693
692
|
declare type __ΩOutputConfig = any[];
|
|
693
|
+
declare type __ΩEngineInputOptions = any[];
|
|
694
694
|
declare type __ΩEngineOptions = any[];
|
|
695
|
-
declare type __ΩResolvedEngineOptions = any[];
|
|
696
695
|
declare type __ΩExecutionOptions = any[];
|
|
697
|
-
declare type __ΩResolvedExecutionOptions = any[];
|
|
698
696
|
declare type __ΩConfig = any[];
|
|
699
697
|
declare type __ΩEnvironmentConfig = any[];
|
|
700
698
|
declare type __ΩUserConfig = any[];
|
|
@@ -721,5 +719,5 @@ declare type __ΩCopyResolvedConfig = any[];
|
|
|
721
719
|
declare type __ΩOutputResolvedConfig = any[];
|
|
722
720
|
declare type __ΩResolvedConfig = any[];
|
|
723
721
|
//#endregion
|
|
724
|
-
export { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig$1 as ResolvedConfig,
|
|
722
|
+
export { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineInputOptions, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig$1 as ResolvedConfig, ResolvedEntryTypeDefinition, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigFn, WorkspaceConfig, __ΩAnyOutputUserConfig, __ΩAnyUserConfig, __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩConfig, __ΩCopyConfig, __ΩCopyResolvedConfig, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEngineInputOptions, __ΩEngineOptions, __ΩEnvironmentConfig, __ΩEnvironmentResolvedConfig, __ΩExecutionOptions, __ΩInlineConfig, __ΩLintInlineConfig, __ΩMode, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginFactory, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩResolveConfig, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩTestInlineConfig, __ΩTypesInlineConfig, __ΩUserConfig, __ΩUserConfigFn, __ΩWorkspaceConfig };
|
|
725
723
|
//# sourceMappingURL=config.d.cts.map
|