@powerlines/engine 0.44.0 → 0.44.2
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/_internal/worker.cjs +186 -169
- package/dist/_internal/worker.d.cts.map +1 -1
- package/dist/_internal/worker.d.mts.map +1 -1
- package/dist/_internal/worker.mjs +187 -170
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +7 -7
- package/dist/api.mjs +5 -5
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-5_AZZYFu.cjs → base-context-CAA1druQ.cjs} +62 -33
- package/dist/{base-context-D_ZidDDm.mjs → base-context-fOM4ZWUo.mjs} +67 -38
- package/dist/base-context-fOM4ZWUo.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +38 -52
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +38 -52
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-PQ3BgcgR.mjs → engine-context-BWGxMU_n.mjs} +2 -2
- package/dist/{engine-context-PQ3BgcgR.mjs.map → engine-context-BWGxMU_n.mjs.map} +1 -1
- package/dist/{engine-context-w4fts28j.cjs → engine-context-CUPubmrM.cjs} +1 -1
- package/dist/{execution-context-0GmpbWbs.cjs → execution-context-BoJhCK0d.cjs} +125 -117
- package/dist/{execution-context-zedP0h4Z.mjs → execution-context-CFJst4Fz.mjs} +127 -119
- package/dist/execution-context-CFJst4Fz.mjs.map +1 -0
- package/dist/index.cjs +114 -53
- package/dist/index.d.cts +8 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +114 -53
- package/dist/index.mjs.map +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/{tsconfig-Cstsoprg.mjs → tsconfig-CI6bla4E.mjs} +2 -2
- package/dist/{tsconfig-Cstsoprg.mjs.map → tsconfig-CI6bla4E.mjs.map} +1 -1
- package/dist/{tsconfig-DeyWQC2N.cjs → tsconfig-QMSxSwBD.cjs} +1 -1
- package/dist/typescript/index.cjs +1 -1
- package/dist/typescript/index.mjs +1 -1
- package/dist/{virtual-CUgOdyIa.mjs → virtual-CYGZHTDd.mjs} +5 -5
- package/dist/virtual-CYGZHTDd.mjs.map +1 -0
- package/dist/{virtual-1hYa9zCy.cjs → virtual-Ct3ZqPeN.cjs} +2 -2
- package/package.json +3 -3
- package/dist/base-context-D_ZidDDm.mjs.map +0 -1
- package/dist/execution-context-zedP0h4Z.mjs.map +0 -1
- package/dist/virtual-CUgOdyIa.mjs.map +0 -1
|
@@ -27,10 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
}) : target, mod));
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
|
-
let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
|
|
31
30
|
let _powerlines_core_lib_utilities_file_header = require("@powerlines/core/lib/utilities/file-header");
|
|
32
31
|
let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
|
|
33
32
|
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
33
|
+
let _powerlines_core_plugin_utils_logging = require("@powerlines/core/plugin-utils/logging");
|
|
34
34
|
let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
|
|
35
35
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
36
36
|
let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
|
|
@@ -68,7 +68,6 @@ let _stryke_fs_json = require("@stryke/fs/json");
|
|
|
68
68
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
69
69
|
let _stryke_path_join = require("@stryke/path/join");
|
|
70
70
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
71
|
-
let _powerlines_core = require("@powerlines/core");
|
|
72
71
|
let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
|
|
73
72
|
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
74
73
|
let _stryke_hash = require("@stryke/hash");
|
|
@@ -82,6 +81,7 @@ let flat_cache = require("flat-cache");
|
|
|
82
81
|
let oxc_parser = require("oxc-parser");
|
|
83
82
|
let undici = require("undici");
|
|
84
83
|
require("@stryke/fs/remove-file");
|
|
84
|
+
let _powerlines_core = require("@powerlines/core");
|
|
85
85
|
let _stryke_capnp = require("@stryke/capnp");
|
|
86
86
|
_stryke_capnp = __toESM(_stryke_capnp, 1);
|
|
87
87
|
let _stryke_fs_buffer = require("@stryke/fs/buffer");
|
|
@@ -103,7 +103,9 @@ let typescript = require("typescript");
|
|
|
103
103
|
typescript = __toESM(typescript, 1);
|
|
104
104
|
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
105
105
|
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
106
|
+
let _stryke_fs = require("@stryke/fs");
|
|
106
107
|
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
108
|
+
let _stryke_path = require("@stryke/path");
|
|
107
109
|
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
108
110
|
let jiti = require("jiti");
|
|
109
111
|
let _stryke_helpers_get_field = require("@stryke/helpers/get-field");
|
|
@@ -199,6 +201,40 @@ async function writeMetaFile(context) {
|
|
|
199
201
|
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
200
202
|
}
|
|
201
203
|
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/_internal/ipc/send.ts
|
|
206
|
+
function sendWriteLogMessage(context, type, message) {
|
|
207
|
+
const meta = {
|
|
208
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(message) && (0, _stryke_type_checks_is_set_object.isSetObject)(message.meta) ? message.meta : {},
|
|
209
|
+
...context.logger.options
|
|
210
|
+
};
|
|
211
|
+
process.send?.({
|
|
212
|
+
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
213
|
+
type: "write-log",
|
|
214
|
+
executionId: meta.executionId ?? context.config.executionId,
|
|
215
|
+
executionIndex: meta.executionIndex ?? context.config.executionIndex,
|
|
216
|
+
environment: meta.environment,
|
|
217
|
+
timestamp: Date.now(),
|
|
218
|
+
payload: {
|
|
219
|
+
meta: {
|
|
220
|
+
type,
|
|
221
|
+
category: meta.category ?? _powerlines_core.LogCategories.GENERAL,
|
|
222
|
+
logId: meta.logId ?? (0, _stryke_unique_id_uuid.uuid)(),
|
|
223
|
+
timestamp: meta.timestamp ?? Date.now(),
|
|
224
|
+
name: meta.name ?? context.config.name,
|
|
225
|
+
executionId: meta.executionId ?? context.config.executionId,
|
|
226
|
+
executionIndex: meta.executionIndex ?? context.config.executionIndex,
|
|
227
|
+
command: meta.command ?? context.config.command,
|
|
228
|
+
hook: meta.hook,
|
|
229
|
+
environment: meta.environment,
|
|
230
|
+
plugin: meta.plugin,
|
|
231
|
+
source: meta.source
|
|
232
|
+
},
|
|
233
|
+
message: (0, _stryke_type_checks_is_set_string.isSetString)(message) ? message : message.message
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
202
238
|
//#endregion
|
|
203
239
|
//#region schemas/fs.ts
|
|
204
240
|
var FileMetadata_KeyValuePair = class extends _stryke_capnp.Struct {
|
|
@@ -1016,9 +1052,9 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1016
1052
|
*/
|
|
1017
1053
|
#context;
|
|
1018
1054
|
/**
|
|
1019
|
-
* The file system's
|
|
1055
|
+
* The file system's logger client utility.
|
|
1020
1056
|
*/
|
|
1021
|
-
#
|
|
1057
|
+
#logger;
|
|
1022
1058
|
/**
|
|
1023
1059
|
* Normalizes a given module id by resolving it against the built-ins path.
|
|
1024
1060
|
*
|
|
@@ -1232,7 +1268,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1232
1268
|
}
|
|
1233
1269
|
}));
|
|
1234
1270
|
} else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(FileSystem));
|
|
1235
|
-
result.#
|
|
1271
|
+
result.#logger.debug("Successfully completed virtual file system (VFS) initialization.");
|
|
1236
1272
|
return result;
|
|
1237
1273
|
}
|
|
1238
1274
|
/**
|
|
@@ -1266,7 +1302,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1266
1302
|
}
|
|
1267
1303
|
});
|
|
1268
1304
|
} else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(FileSystem));
|
|
1269
|
-
result.#
|
|
1305
|
+
result.#logger.debug("Successfully completed virtual file system (VFS) initialization.");
|
|
1270
1306
|
return result;
|
|
1271
1307
|
}
|
|
1272
1308
|
/**
|
|
@@ -1400,7 +1436,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1400
1436
|
return ret;
|
|
1401
1437
|
}, {});
|
|
1402
1438
|
}
|
|
1403
|
-
this.#
|
|
1439
|
+
this.#logger = context.extendLogger({
|
|
1404
1440
|
source: "VFS",
|
|
1405
1441
|
category: "fs"
|
|
1406
1442
|
});
|
|
@@ -1530,7 +1566,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1530
1566
|
listSync(path) {
|
|
1531
1567
|
let resolvedPath = path;
|
|
1532
1568
|
if (resolvedPath.includes("*")) {
|
|
1533
|
-
this.#
|
|
1569
|
+
this.#logger.warn(`Invoking "listSync" with a glob pattern is not supported. It is likely you meant to use "globSync". Path: ${path}`);
|
|
1534
1570
|
resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
|
|
1535
1571
|
}
|
|
1536
1572
|
return (0, _stryke_helpers_get_unique.getUnique)(this.#getStorages(resolvedPath, true).map((storage) => storage.adapter.listSync(storage.relativeBase ? storage.base ? (0, _stryke_path_append.appendPath)(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)).flat().filter(Boolean));
|
|
@@ -1544,7 +1580,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1544
1580
|
async list(path) {
|
|
1545
1581
|
let resolvedPath = path;
|
|
1546
1582
|
if (resolvedPath.includes("*")) {
|
|
1547
|
-
this.#
|
|
1583
|
+
this.#logger.warn(`Invoking "list" with a glob pattern is not supported. It is likely you meant to use "glob". Path: ${path}`);
|
|
1548
1584
|
resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
|
|
1549
1585
|
}
|
|
1550
1586
|
return (0, _stryke_helpers_get_unique.getUnique)((await Promise.all(this.#getStorages(resolvedPath, true).map(async (storage) => storage.adapter.list(storage.relativeBase ? storage.base ? (0, _stryke_path_append.appendPath)(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)))).flat().filter(Boolean));
|
|
@@ -1556,7 +1592,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1556
1592
|
*/
|
|
1557
1593
|
async remove(path) {
|
|
1558
1594
|
const normalizedPath = this.#normalizePath(path);
|
|
1559
|
-
this.#
|
|
1595
|
+
this.#logger.trace(`Removing file: ${normalizedPath}`);
|
|
1560
1596
|
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1561
1597
|
if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) await adapter.remove(relativeKey);
|
|
1562
1598
|
else await adapter.clear(relativeKey);
|
|
@@ -1574,7 +1610,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1574
1610
|
*/
|
|
1575
1611
|
removeSync(path) {
|
|
1576
1612
|
const normalizedPath = this.#normalizePath(path);
|
|
1577
|
-
this.#
|
|
1613
|
+
this.#logger.trace(`Removing file: ${normalizedPath}`);
|
|
1578
1614
|
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1579
1615
|
if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) adapter.removeSync(relativeKey);
|
|
1580
1616
|
else adapter.clearSync(relativeKey);
|
|
@@ -1720,7 +1756,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1720
1756
|
const filePath = await this.resolve(path, void 0, { isFile: true });
|
|
1721
1757
|
if (!filePath || !this.existsSync(filePath)) return;
|
|
1722
1758
|
const { adapter } = this.#getStorage(filePath);
|
|
1723
|
-
this.#
|
|
1759
|
+
this.#logger.trace(`Reading ${adapter.name} file: ${filePath}`);
|
|
1724
1760
|
return await adapter.get(filePath) ?? void 0;
|
|
1725
1761
|
}
|
|
1726
1762
|
/**
|
|
@@ -1733,7 +1769,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1733
1769
|
const filePath = this.resolveSync(path, void 0, { isFile: true });
|
|
1734
1770
|
if (!filePath || !this.existsSync(filePath)) return;
|
|
1735
1771
|
const { adapter } = this.#getStorage(filePath);
|
|
1736
|
-
this.#
|
|
1772
|
+
this.#logger.trace(`Reading ${adapter.name} file: ${filePath}`);
|
|
1737
1773
|
return adapter.getSync(filePath) ?? void 0;
|
|
1738
1774
|
}
|
|
1739
1775
|
/**
|
|
@@ -1748,15 +1784,15 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1748
1784
|
const meta = options.meta ?? {};
|
|
1749
1785
|
const resolvedPath = await this.resolve(this.#normalizePath(path)) || path;
|
|
1750
1786
|
const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
|
|
1751
|
-
this.#
|
|
1787
|
+
this.#logger.trace(`Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
|
|
1752
1788
|
let code = data;
|
|
1753
1789
|
try {
|
|
1754
1790
|
if (!options.skipFormat) code = await (0, _powerlines_core_lib_utilities_format.format)(this.#context, resolvedPath, data);
|
|
1755
1791
|
} catch (err) {
|
|
1756
|
-
if (DEFAULT_EXTENSIONS.includes((0, _stryke_path_file_path_fns.findFileExtensionSafe)(resolvedPath, { fullExtension: true }))) this.#
|
|
1792
|
+
if (DEFAULT_EXTENSIONS.includes((0, _stryke_path_file_path_fns.findFileExtensionSafe)(resolvedPath, { fullExtension: true }))) this.#logger.warn(`Failed to format file ${resolvedPath} before writing: ${err.message}`);
|
|
1757
1793
|
code = data;
|
|
1758
1794
|
}
|
|
1759
|
-
this.#
|
|
1795
|
+
this.#logger.trace(`Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(code)).size)})`);
|
|
1760
1796
|
const id = this.#normalizeId(meta.id || resolvedPath);
|
|
1761
1797
|
this.metadata[id] = {
|
|
1762
1798
|
type: "normal",
|
|
@@ -1779,7 +1815,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1779
1815
|
const meta = options.meta ?? {};
|
|
1780
1816
|
const resolvedPath = this.resolveSync(this.#normalizePath(path)) || path;
|
|
1781
1817
|
const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
|
|
1782
|
-
this.#
|
|
1818
|
+
this.#logger.trace(`Writing ${resolvedPath} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
|
|
1783
1819
|
const id = this.#normalizeId(meta.id || resolvedPath);
|
|
1784
1820
|
this.metadata[id] = {
|
|
1785
1821
|
type: "normal",
|
|
@@ -1943,7 +1979,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1943
1979
|
async dispose() {
|
|
1944
1980
|
if (!this.#isDisposed) {
|
|
1945
1981
|
this.#isDisposed = true;
|
|
1946
|
-
this.#
|
|
1982
|
+
this.#logger.debug("Disposing virtual file system...");
|
|
1947
1983
|
await this.remove((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"));
|
|
1948
1984
|
const message = new _stryke_capnp.Message();
|
|
1949
1985
|
const fs = message.initRoot(FileSystem);
|
|
@@ -1978,7 +2014,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1978
2014
|
await (0, _stryke_fs_buffer.writeFileBuffer)((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
1979
2015
|
if (!this.#context.config.skipCache) this.resolverCache.save(true);
|
|
1980
2016
|
await Promise.all(this.#getStorages().map(async (storage) => storage.adapter.dispose()));
|
|
1981
|
-
this.#
|
|
2017
|
+
this.#logger.trace("Virtual file system has been disposed.");
|
|
1982
2018
|
}
|
|
1983
2019
|
}
|
|
1984
2020
|
/**
|
|
@@ -2159,6 +2195,7 @@ function createResolver(options) {
|
|
|
2159
2195
|
//#region src/context/base-context.ts
|
|
2160
2196
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
2161
2197
|
#timestamp = Date.now();
|
|
2198
|
+
#name = "powerlines";
|
|
2162
2199
|
/**
|
|
2163
2200
|
* The path to the Powerlines package
|
|
2164
2201
|
*/
|
|
@@ -2180,6 +2217,15 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2180
2217
|
*/
|
|
2181
2218
|
configFile;
|
|
2182
2219
|
/**
|
|
2220
|
+
* The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.
|
|
2221
|
+
*/
|
|
2222
|
+
get logger() {
|
|
2223
|
+
return this.createLogger({
|
|
2224
|
+
...this.configFile.config,
|
|
2225
|
+
...this.options
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2183
2229
|
* A timestamp representing when the context was initialized
|
|
2184
2230
|
*/
|
|
2185
2231
|
get timestamp() {
|
|
@@ -2189,12 +2235,6 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2189
2235
|
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(this.options.logLevel, this.options.mode);
|
|
2190
2236
|
}
|
|
2191
2237
|
/**
|
|
2192
|
-
* The logger function
|
|
2193
|
-
*/
|
|
2194
|
-
get log() {
|
|
2195
|
-
return this.createLog();
|
|
2196
|
-
}
|
|
2197
|
-
/**
|
|
2198
2238
|
* The environment paths for the project
|
|
2199
2239
|
*/
|
|
2200
2240
|
get envPaths() {
|
|
@@ -2223,7 +2263,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2223
2263
|
* @param message - The message to log.
|
|
2224
2264
|
*/
|
|
2225
2265
|
fatal(message) {
|
|
2226
|
-
this.
|
|
2266
|
+
this.logger.error((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2227
2267
|
}
|
|
2228
2268
|
/**
|
|
2229
2269
|
* A logging function for error messages
|
|
@@ -2231,7 +2271,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2231
2271
|
* @param message - The message to log.
|
|
2232
2272
|
*/
|
|
2233
2273
|
error(message) {
|
|
2234
|
-
this.
|
|
2274
|
+
this.logger.error((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2235
2275
|
}
|
|
2236
2276
|
/**
|
|
2237
2277
|
* A logging function for warning messages
|
|
@@ -2239,7 +2279,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2239
2279
|
* @param message - The message to log.
|
|
2240
2280
|
*/
|
|
2241
2281
|
warn(message) {
|
|
2242
|
-
this.
|
|
2282
|
+
this.logger.warn((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2243
2283
|
}
|
|
2244
2284
|
/**
|
|
2245
2285
|
* A logging function for informational messages
|
|
@@ -2247,7 +2287,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2247
2287
|
* @param message - The message to log.
|
|
2248
2288
|
*/
|
|
2249
2289
|
info(message) {
|
|
2250
|
-
this.
|
|
2290
|
+
this.logger.info((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2251
2291
|
}
|
|
2252
2292
|
/**
|
|
2253
2293
|
* A logging function for debug messages
|
|
@@ -2255,7 +2295,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2255
2295
|
* @param message - The message to log.
|
|
2256
2296
|
*/
|
|
2257
2297
|
debug(message) {
|
|
2258
|
-
this.
|
|
2298
|
+
this.logger.debug((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2259
2299
|
}
|
|
2260
2300
|
/**
|
|
2261
2301
|
* A logging function for trace messages
|
|
@@ -2263,7 +2303,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2263
2303
|
* @param message - The message to log.
|
|
2264
2304
|
*/
|
|
2265
2305
|
trace(message) {
|
|
2266
|
-
this.
|
|
2306
|
+
this.logger.trace((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2267
2307
|
}
|
|
2268
2308
|
/**
|
|
2269
2309
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
@@ -2283,38 +2323,31 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2283
2323
|
const startDuration = performance.now();
|
|
2284
2324
|
return () => {
|
|
2285
2325
|
const duration = performance.now() - startDuration;
|
|
2286
|
-
this.
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
}
|
|
2326
|
+
this.logger.info({
|
|
2327
|
+
meta: { category: "performance" },
|
|
2328
|
+
message: `${chalk.default.bold.cyanBright(name)} completed in ${chalk.default.bold.cyanBright(duration < 1e3 ? `${duration.toFixed(2)} milliseconds` : (0, date_fns_formatDistanceToNowStrict.formatDistanceToNowStrict)(startDate))}`
|
|
2329
|
+
});
|
|
2290
2330
|
};
|
|
2291
2331
|
}
|
|
2292
2332
|
/**
|
|
2293
2333
|
* Create a new logger instance
|
|
2294
2334
|
*
|
|
2295
|
-
* @param
|
|
2296
|
-
* @returns A logger
|
|
2335
|
+
* @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.
|
|
2336
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2297
2337
|
*/
|
|
2298
|
-
|
|
2299
|
-
return (0,
|
|
2300
|
-
...this.options,
|
|
2301
|
-
...config
|
|
2302
|
-
});
|
|
2338
|
+
createLogger(options, callback) {
|
|
2339
|
+
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root, options, callback);
|
|
2303
2340
|
}
|
|
2304
2341
|
/**
|
|
2305
|
-
* Extend the
|
|
2342
|
+
* Extend the base logger with additional configuration options
|
|
2306
2343
|
*
|
|
2307
|
-
* @param
|
|
2308
|
-
* @returns A new logger
|
|
2344
|
+
* @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.
|
|
2345
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
2309
2346
|
*/
|
|
2310
|
-
|
|
2311
|
-
return (0,
|
|
2347
|
+
extendLogger(options) {
|
|
2348
|
+
return (0, _powerlines_core_plugin_utils_logging.extendLogger)(this.logger, options);
|
|
2312
2349
|
}
|
|
2313
2350
|
/**
|
|
2314
|
-
* A logger function specific to this context
|
|
2315
|
-
*/
|
|
2316
|
-
logger;
|
|
2317
|
-
/**
|
|
2318
2351
|
* Initialize the context with the provided configuration options
|
|
2319
2352
|
*
|
|
2320
2353
|
* @remarks
|
|
@@ -2332,6 +2365,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2332
2365
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
2333
2366
|
const root = (0, _stryke_path_replace.replacePath)((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !(0, _stryke_path_is_equal.isEqual)(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
|
|
2334
2367
|
this.options = (0, defu.default)({
|
|
2368
|
+
name: options.name,
|
|
2335
2369
|
root,
|
|
2336
2370
|
cwd,
|
|
2337
2371
|
mode: options.mode,
|
|
@@ -2351,6 +2385,31 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2351
2385
|
logLevel: this.logLevel
|
|
2352
2386
|
});
|
|
2353
2387
|
this.configFile = await (0, _powerlines_core_lib_config.loadUserConfigFile)(this.options, this.resolver);
|
|
2388
|
+
if (!this.options.name) {
|
|
2389
|
+
if (this.configFile.config) {
|
|
2390
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.configFile.config) && (0, _stryke_type_checks_is_set_string.isSetString)(this.configFile.config.name)) this.options.name = this.configFile.config.name;
|
|
2391
|
+
else if (Array.isArray(this.configFile.config)) {
|
|
2392
|
+
for (const config of this.configFile.config) if ((0, _stryke_type_checks_is_set_object.isSetObject)(config) && (0, _stryke_type_checks_is_set_string.isSetString)(config.name)) {
|
|
2393
|
+
this.options.name = config.name;
|
|
2394
|
+
break;
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
if (!this.options.name) {
|
|
2399
|
+
const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "package.json");
|
|
2400
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) {
|
|
2401
|
+
const packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
|
|
2402
|
+
this.options.name = packageJson.name;
|
|
2403
|
+
}
|
|
2404
|
+
if (!this.options.name) {
|
|
2405
|
+
const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "project.json");
|
|
2406
|
+
if ((0, node_fs.existsSync)(projectJsonPath)) {
|
|
2407
|
+
const projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
|
|
2408
|
+
this.options.name = projectJson.name;
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2354
2413
|
}
|
|
2355
2414
|
};
|
|
2356
2415
|
|
|
@@ -2601,6 +2660,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2601
2660
|
}, {}) : this.config.resolve.alias : {});
|
|
2602
2661
|
}
|
|
2603
2662
|
/**
|
|
2663
|
+
* The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.
|
|
2664
|
+
*/
|
|
2665
|
+
get logger() {
|
|
2666
|
+
const options = {
|
|
2667
|
+
...this.config,
|
|
2668
|
+
...this.options
|
|
2669
|
+
};
|
|
2670
|
+
const logger = (0, _powerlines_core_plugin_utils.withLogger)((0, _powerlines_core_plugin_utils.createLogger)(this.config.name, options), (0, _powerlines_core_plugin_utils.createLogger)(this.config.name, options, (type, message) => sendWriteLogMessage(this, type, message)));
|
|
2671
|
+
if (this.config.customLogger) return (0, _powerlines_core_plugin_utils.withCustomLogger)(logger, this.config.customLogger);
|
|
2672
|
+
return logger;
|
|
2673
|
+
}
|
|
2674
|
+
/**
|
|
2604
2675
|
* Gets the parser cache.
|
|
2605
2676
|
*/
|
|
2606
2677
|
get parserCache() {
|
|
@@ -2655,60 +2726,6 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2655
2726
|
this.options = options;
|
|
2656
2727
|
}
|
|
2657
2728
|
/**
|
|
2658
|
-
* Create a new log function with the specified configuration, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
|
|
2659
|
-
*
|
|
2660
|
-
* @param config - Optional configuration for the log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
|
|
2661
|
-
* @returns A log function that can be used to log messages with the specified configuration.
|
|
2662
|
-
*/
|
|
2663
|
-
createLog(config) {
|
|
2664
|
-
const log = (0, _powerlines_core.createLogFn)({
|
|
2665
|
-
...config,
|
|
2666
|
-
logLevel: this.logLevel
|
|
2667
|
-
});
|
|
2668
|
-
return (meta, ...args) => {
|
|
2669
|
-
log(meta, ...args);
|
|
2670
|
-
process.send?.({
|
|
2671
|
-
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
2672
|
-
type: "write-log",
|
|
2673
|
-
executionId: config?.executionId ?? this.options.executionId,
|
|
2674
|
-
executionIndex: config?.executionIndex ?? this.options.executionIndex,
|
|
2675
|
-
timestamp: Date.now(),
|
|
2676
|
-
payload: {
|
|
2677
|
-
level: meta && (0, _stryke_type_checks_is_set_object.isSetObject)(meta) && (0, _stryke_type_checks_is_set_string.isSetString)(meta.level) ? meta.level : (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : "info",
|
|
2678
|
-
...config,
|
|
2679
|
-
args
|
|
2680
|
-
}
|
|
2681
|
-
});
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
/**
|
|
2685
|
-
* Extend the current log function instance with a new name
|
|
2686
|
-
*
|
|
2687
|
-
* @param config - The configuration for the extended log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the log function instance according to your needs.
|
|
2688
|
-
* @returns A log function
|
|
2689
|
-
*/
|
|
2690
|
-
extendLog(config) {
|
|
2691
|
-
const log = (0, _powerlines_core.extendLogFn)(this.log, {
|
|
2692
|
-
...config,
|
|
2693
|
-
logLevel: this.logLevel
|
|
2694
|
-
});
|
|
2695
|
-
return (meta, ...args) => {
|
|
2696
|
-
log(meta, ...args);
|
|
2697
|
-
process.send?.({
|
|
2698
|
-
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
2699
|
-
type: "write-log",
|
|
2700
|
-
executionId: config.executionId ?? this.options.executionId,
|
|
2701
|
-
executionIndex: config.executionIndex ?? this.options.executionIndex,
|
|
2702
|
-
timestamp: Date.now(),
|
|
2703
|
-
payload: {
|
|
2704
|
-
level: meta && (0, _stryke_type_checks_is_set_object.isSetObject)(meta) && (0, _stryke_type_checks_is_set_string.isSetString)(meta.level) ? meta.level : (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : "info",
|
|
2705
|
-
...config,
|
|
2706
|
-
args
|
|
2707
|
-
}
|
|
2708
|
-
});
|
|
2709
|
-
};
|
|
2710
|
-
}
|
|
2711
|
-
/**
|
|
2712
2729
|
* Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
|
|
2713
2730
|
*
|
|
2714
2731
|
* @remarks
|
|
@@ -2751,6 +2768,9 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2751
2768
|
headers: cached.headers
|
|
2752
2769
|
});
|
|
2753
2770
|
}
|
|
2771
|
+
const logger = this.extendLogger({ category: "network" });
|
|
2772
|
+
const startTime = Date.now();
|
|
2773
|
+
logger.trace(`Sending fetch request (${options.method?.toUpperCase() || "GET"}): ${input.toString()}`);
|
|
2754
2774
|
const response = await (0, _stryke_http_fetch.fetchRequest)(input, {
|
|
2755
2775
|
timeout: 12e3,
|
|
2756
2776
|
...options
|
|
@@ -2764,6 +2784,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2764
2784
|
if (!this.config.skipCache && !options.skipCache) try {
|
|
2765
2785
|
this.requestCache.set(cacheKey, result);
|
|
2766
2786
|
} catch {}
|
|
2787
|
+
logger.trace(`Fetch request (${options.method?.toUpperCase() || "GET"}) completed in ${Date.now() - startTime}ms: ${input.toString()} - ${response.status} / ${response.statusText} \n - Response Headers: ${JSON.stringify(result.headers)}\n - Response Body: ${typeof result.body === "string" ? result.body.length > 1e3 ? `${result.body.slice(0, 1e3)}... (truncated, total length: ${result.body.length})` : result.body : "[Non-string body]"}`);
|
|
2767
2788
|
return new undici.Response(result.body, {
|
|
2768
2789
|
status: result.status,
|
|
2769
2790
|
statusText: result.statusText,
|
|
@@ -3139,6 +3160,13 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3139
3160
|
* Initialize the context with the provided configuration options
|
|
3140
3161
|
*/
|
|
3141
3162
|
async innerSetup() {
|
|
3163
|
+
const logger = this.extendLogger({ category: "config" });
|
|
3164
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${JSON.stringify({
|
|
3165
|
+
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3166
|
+
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3167
|
+
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
3168
|
+
pluginConfig: this.config.pluginConfig ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : {}
|
|
3169
|
+
}, null, 2)}`);
|
|
3142
3170
|
if (!this.inputOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
3143
3171
|
this.options.mode = "production";
|
|
3144
3172
|
this.config.mode = "production";
|
|
@@ -3165,8 +3193,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3165
3193
|
else this.config.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
3166
3194
|
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
3167
3195
|
else if (this.config.tsconfig) this.config.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.tsconfig), this.config.cwd);
|
|
3168
|
-
this.
|
|
3169
|
-
path: (0, _stryke_path_join.joinPaths)(this.config.root, "dist"),
|
|
3196
|
+
this.config.output = (0, defu.default)(this.config.output ?? {}, {
|
|
3170
3197
|
copy: { assets: [
|
|
3171
3198
|
{ glob: "LICENSE" },
|
|
3172
3199
|
{
|
|
@@ -3183,6 +3210,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3183
3210
|
});
|
|
3184
3211
|
this.config.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
3185
3212
|
if (this.config.output.path) this.config.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.path), this.config.cwd);
|
|
3213
|
+
else this.config.output.path = (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(this.config.root, "dist"), this.config.cwd);
|
|
3186
3214
|
if (this.config.output.copy !== false) {
|
|
3187
3215
|
this.config.output.copy ??= {};
|
|
3188
3216
|
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
@@ -3210,7 +3238,12 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3210
3238
|
}));
|
|
3211
3239
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.output?.storage) && this.config.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
|
|
3212
3240
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3213
|
-
this.
|
|
3241
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig)) logger.debug(`Resolved Powerlines configuration object: \n${JSON.stringify({
|
|
3242
|
+
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3243
|
+
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3244
|
+
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
3245
|
+
pluginConfig: this.config.pluginConfig ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : {}
|
|
3246
|
+
}, null, 2)}`);
|
|
3214
3247
|
}
|
|
3215
3248
|
};
|
|
3216
3249
|
|
|
@@ -3260,7 +3293,7 @@ function mergeConfigs(currentResult, previousResults) {
|
|
|
3260
3293
|
async function callHook(context, key, options, ...args) {
|
|
3261
3294
|
const hooks = context.selectHooks(key, options);
|
|
3262
3295
|
if (hooks.length > 0) {
|
|
3263
|
-
context.debug(` 🧩 Calling ${hooks.length} ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => ` ${index + 1}. ${(0,
|
|
3296
|
+
context.extendLogger({ category: "hooks" }).debug(` 🧩 Calling ${hooks.length} ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => ` ${index + 1}. ${(0, _powerlines_core_plugin_utils_logging.colorText)(hook.plugin.name)}`).join("\n")}`);
|
|
3264
3297
|
const invokeHook = async (hook, hookArgs) => {
|
|
3265
3298
|
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
3266
3299
|
};
|
|
@@ -3360,7 +3393,7 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3360
3393
|
const normalizeMessage = (message) => {
|
|
3361
3394
|
return (0, _stryke_type_checks_is_string.isString)(message) ? message : message.message;
|
|
3362
3395
|
};
|
|
3363
|
-
const
|
|
3396
|
+
const logger = environment.extendLogger({ plugin: plugin.name.replaceAll(":", " - ") });
|
|
3364
3397
|
const callHookFn = async (hook, options, ...args) => {
|
|
3365
3398
|
return environment.$$internal.api.callHook(hook, {
|
|
3366
3399
|
sequential: true,
|
|
@@ -3379,24 +3412,24 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3379
3412
|
meta
|
|
3380
3413
|
};
|
|
3381
3414
|
if (prop === "id") return pluginId;
|
|
3382
|
-
if (prop === "
|
|
3415
|
+
if (prop === "logger") return logger;
|
|
3383
3416
|
if (prop === "fatal") return (message) => {
|
|
3384
|
-
|
|
3417
|
+
logger.error(normalizeMessage(message));
|
|
3385
3418
|
};
|
|
3386
3419
|
if (prop === "error") return (message) => {
|
|
3387
|
-
|
|
3420
|
+
logger.error(normalizeMessage(message));
|
|
3388
3421
|
};
|
|
3389
3422
|
if (prop === "warn") return (message) => {
|
|
3390
|
-
|
|
3423
|
+
logger.warn(normalizeMessage(message));
|
|
3391
3424
|
};
|
|
3392
3425
|
if (prop === "info") return (message) => {
|
|
3393
|
-
|
|
3426
|
+
logger.info(normalizeMessage(message));
|
|
3394
3427
|
};
|
|
3395
3428
|
if (prop === "debug") return (message) => {
|
|
3396
|
-
|
|
3429
|
+
logger.debug(normalizeMessage(message));
|
|
3397
3430
|
};
|
|
3398
3431
|
if (prop === "trace") return (message) => {
|
|
3399
|
-
|
|
3432
|
+
logger.trace(normalizeMessage(message));
|
|
3400
3433
|
};
|
|
3401
3434
|
return environment[prop];
|
|
3402
3435
|
},
|
|
@@ -3415,7 +3448,7 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3415
3448
|
"addPlugin",
|
|
3416
3449
|
"selectHooks"
|
|
3417
3450
|
].includes(prop)) {
|
|
3418
|
-
|
|
3451
|
+
logger.warn(`Cannot set the read-only "${String(prop)}" property`);
|
|
3419
3452
|
return false;
|
|
3420
3453
|
}
|
|
3421
3454
|
environment[prop] = value;
|
|
@@ -3467,26 +3500,26 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
3467
3500
|
return this.#hooks;
|
|
3468
3501
|
}
|
|
3469
3502
|
/**
|
|
3470
|
-
* Create a new
|
|
3503
|
+
* Create a new logger instance
|
|
3471
3504
|
*
|
|
3472
|
-
* @param
|
|
3473
|
-
* @returns A
|
|
3505
|
+
* @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.
|
|
3506
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3474
3507
|
*/
|
|
3475
|
-
|
|
3476
|
-
return super.
|
|
3477
|
-
...
|
|
3508
|
+
createLogger(options, callback) {
|
|
3509
|
+
return super.createLogger({
|
|
3510
|
+
...options,
|
|
3478
3511
|
environment: this.environment?.name
|
|
3479
|
-
});
|
|
3512
|
+
}, callback);
|
|
3480
3513
|
}
|
|
3481
3514
|
/**
|
|
3482
|
-
* Extend the
|
|
3515
|
+
* Extend the base logger with additional configuration options
|
|
3483
3516
|
*
|
|
3484
|
-
* @param
|
|
3485
|
-
* @returns A
|
|
3517
|
+
* @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.
|
|
3518
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
3486
3519
|
*/
|
|
3487
|
-
|
|
3488
|
-
return super.
|
|
3489
|
-
...
|
|
3520
|
+
extendLogger(options) {
|
|
3521
|
+
return super.extendLogger({
|
|
3522
|
+
...options,
|
|
3490
3523
|
environment: this.environment?.name
|
|
3491
3524
|
});
|
|
3492
3525
|
}
|
|
@@ -3672,27 +3705,27 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
3672
3705
|
super(options);
|
|
3673
3706
|
}
|
|
3674
3707
|
/**
|
|
3675
|
-
* Create a new
|
|
3708
|
+
* Create a new logger instance
|
|
3676
3709
|
*
|
|
3677
|
-
* @param
|
|
3678
|
-
* @returns A
|
|
3710
|
+
* @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.
|
|
3711
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3679
3712
|
*/
|
|
3680
|
-
|
|
3681
|
-
return super.
|
|
3682
|
-
...
|
|
3713
|
+
createLogger(options, callback) {
|
|
3714
|
+
return super.createLogger({
|
|
3715
|
+
...options,
|
|
3683
3716
|
executionId: this.id,
|
|
3684
3717
|
executionIndex: this.options.executionIndex
|
|
3685
|
-
});
|
|
3718
|
+
}, callback);
|
|
3686
3719
|
}
|
|
3687
3720
|
/**
|
|
3688
|
-
* Extend the
|
|
3721
|
+
* Extend the base logger with additional configuration options
|
|
3689
3722
|
*
|
|
3690
|
-
* @param
|
|
3691
|
-
* @returns A
|
|
3723
|
+
* @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.
|
|
3724
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
3692
3725
|
*/
|
|
3693
|
-
|
|
3694
|
-
return super.
|
|
3695
|
-
...
|
|
3726
|
+
extendLogger(options) {
|
|
3727
|
+
return super.extendLogger({
|
|
3728
|
+
...options,
|
|
3696
3729
|
executionId: this.id,
|
|
3697
3730
|
executionIndex: this.options.executionIndex
|
|
3698
3731
|
});
|
|
@@ -4561,7 +4594,7 @@ ${formatTypes(code)}
|
|
|
4561
4594
|
const timer = api.context.timer("Initialization");
|
|
4562
4595
|
for (const plugin of api.context.config.plugins.flatMap((p) => (0, _stryke_convert_to_array.toArray)(p)) ?? []) await api.addPlugin(plugin);
|
|
4563
4596
|
if (api.context.plugins.length === 0) api.context.warn("No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
|
|
4564
|
-
else api.context.info(`Loaded ${api.context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0,
|
|
4597
|
+
else api.context.info(`Loaded ${api.context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, _powerlines_core_plugin_utils_logging.colorText)(plugin.name)}`).join("\n")}`);
|
|
4565
4598
|
const pluginConfig = await api.callHook("config", {
|
|
4566
4599
|
environment: await api.context.getEnvironment(),
|
|
4567
4600
|
sequential: true,
|
|
@@ -4901,44 +4934,28 @@ ${formatTypes(code)}
|
|
|
4901
4934
|
//#endregion
|
|
4902
4935
|
//#region src/_internal/worker.ts
|
|
4903
4936
|
async function clean({ options, config }) {
|
|
4904
|
-
|
|
4905
|
-
await execution.clean(config);
|
|
4906
|
-
await execution.finalize();
|
|
4937
|
+
await (await PowerlinesExecution.fromConfig(options, config)).clean(config);
|
|
4907
4938
|
}
|
|
4908
4939
|
async function prepare({ options, config }) {
|
|
4909
|
-
|
|
4910
|
-
await execution.prepare(config);
|
|
4911
|
-
await execution.finalize();
|
|
4940
|
+
await (await PowerlinesExecution.fromConfig(options, config)).prepare(config);
|
|
4912
4941
|
}
|
|
4913
4942
|
async function types({ options, config }) {
|
|
4914
|
-
|
|
4915
|
-
await execution.types(config);
|
|
4916
|
-
await execution.finalize();
|
|
4943
|
+
await (await PowerlinesExecution.fromConfig(options, config)).types(config);
|
|
4917
4944
|
}
|
|
4918
4945
|
async function lint({ options, config }) {
|
|
4919
|
-
|
|
4920
|
-
await execution.lint(config);
|
|
4921
|
-
await execution.finalize();
|
|
4946
|
+
await (await PowerlinesExecution.fromConfig(options, config)).lint(config);
|
|
4922
4947
|
}
|
|
4923
4948
|
async function test({ options, config }) {
|
|
4924
|
-
|
|
4925
|
-
await execution.test(config);
|
|
4926
|
-
await execution.finalize();
|
|
4949
|
+
await (await PowerlinesExecution.fromConfig(options, config)).test(config);
|
|
4927
4950
|
}
|
|
4928
4951
|
async function build({ options, config }) {
|
|
4929
|
-
|
|
4930
|
-
await execution.build(config);
|
|
4931
|
-
await execution.finalize();
|
|
4952
|
+
await (await PowerlinesExecution.fromConfig(options, config)).build(config);
|
|
4932
4953
|
}
|
|
4933
4954
|
async function docs({ options, config }) {
|
|
4934
|
-
|
|
4935
|
-
await execution.docs(config);
|
|
4936
|
-
await execution.finalize();
|
|
4955
|
+
await (await PowerlinesExecution.fromConfig(options, config)).docs(config);
|
|
4937
4956
|
}
|
|
4938
4957
|
async function deploy({ options, config }) {
|
|
4939
|
-
|
|
4940
|
-
await execution.deploy(config);
|
|
4941
|
-
await execution.finalize();
|
|
4958
|
+
await (await PowerlinesExecution.fromConfig(options, config)).deploy(config);
|
|
4942
4959
|
}
|
|
4943
4960
|
|
|
4944
4961
|
//#endregion
|