@powerlines/engine 0.43.31 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/worker.cjs +187 -169
- package/dist/_internal/worker.d.cts.map +1 -1
- package/dist/_internal/worker.d.mts.map +1 -1
- package/dist/_internal/worker.mjs +188 -170
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +6 -5
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +4 -3
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-CPoqO4io.cjs → base-context-DkGTyGX0.cjs} +34 -44
- package/dist/{base-context-SmQ6OfXm.mjs → base-context-Dv5OTHxZ.mjs} +35 -45
- package/dist/base-context-Dv5OTHxZ.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +40 -36
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +40 -36
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-CEu21ZZf.cjs → engine-context-CDSR7PHF.cjs} +1 -1
- package/dist/{engine-context-D7CWyTsr.mjs → engine-context-CytME-Ht.mjs} +2 -2
- package/dist/{engine-context-D7CWyTsr.mjs.map → engine-context-CytME-Ht.mjs.map} +1 -1
- package/dist/{execution-context-DsT6s1du.cjs → execution-context-B-CVP76S.cjs} +148 -105
- package/dist/{execution-context-C_7IC8er.mjs → execution-context-F7RyGqff.mjs} +150 -107
- package/dist/execution-context-F7RyGqff.mjs.map +1 -0
- package/dist/index.cjs +8 -12
- package/dist/index.mjs +8 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/base-context-SmQ6OfXm.mjs.map +0 -1
- package/dist/execution-context-C_7IC8er.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");
|
|
@@ -63,12 +63,10 @@ let defu = require("defu");
|
|
|
63
63
|
defu = __toESM(defu, 1);
|
|
64
64
|
let handlebars = require("handlebars");
|
|
65
65
|
handlebars = __toESM(handlebars, 1);
|
|
66
|
-
let _powerlines_core = require("@powerlines/core");
|
|
67
66
|
let _powerlines_core_constants = require("@powerlines/core/constants");
|
|
68
67
|
let _stryke_fs_json = require("@stryke/fs/json");
|
|
69
68
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
70
69
|
let _stryke_path_join = require("@stryke/path/join");
|
|
71
|
-
let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
|
|
72
70
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
73
71
|
let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
|
|
74
72
|
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
@@ -83,7 +81,7 @@ let flat_cache = require("flat-cache");
|
|
|
83
81
|
let oxc_parser = require("oxc-parser");
|
|
84
82
|
let undici = require("undici");
|
|
85
83
|
require("@stryke/fs/remove-file");
|
|
86
|
-
let
|
|
84
|
+
let _powerlines_core = require("@powerlines/core");
|
|
87
85
|
let _stryke_capnp = require("@stryke/capnp");
|
|
88
86
|
_stryke_capnp = __toESM(_stryke_capnp, 1);
|
|
89
87
|
let _stryke_fs_buffer = require("@stryke/fs/buffer");
|
|
@@ -201,6 +199,40 @@ async function writeMetaFile(context) {
|
|
|
201
199
|
await context.fs.write(metaFilePath, JSON.stringify(context.meta, null, 2));
|
|
202
200
|
}
|
|
203
201
|
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/_internal/ipc/send.ts
|
|
204
|
+
function sendWriteLogMessage(context, type, message) {
|
|
205
|
+
const meta = {
|
|
206
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(message) && (0, _stryke_type_checks_is_set_object.isSetObject)(message.meta) ? message.meta : {},
|
|
207
|
+
...context.logger.options
|
|
208
|
+
};
|
|
209
|
+
process.send?.({
|
|
210
|
+
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
211
|
+
type: "write-log",
|
|
212
|
+
executionId: meta.executionId ?? context.config.executionId,
|
|
213
|
+
executionIndex: meta.executionIndex ?? context.config.executionIndex,
|
|
214
|
+
environment: meta.environment,
|
|
215
|
+
timestamp: Date.now(),
|
|
216
|
+
payload: {
|
|
217
|
+
meta: {
|
|
218
|
+
type,
|
|
219
|
+
category: meta.category ?? _powerlines_core.LogCategories.GENERAL,
|
|
220
|
+
logId: meta.logId ?? (0, _stryke_unique_id_uuid.uuid)(),
|
|
221
|
+
timestamp: meta.timestamp ?? Date.now(),
|
|
222
|
+
name: meta.name ?? context.config.name,
|
|
223
|
+
executionId: meta.executionId ?? context.config.executionId,
|
|
224
|
+
executionIndex: meta.executionIndex ?? context.config.executionIndex,
|
|
225
|
+
command: meta.command ?? context.config.command,
|
|
226
|
+
hook: meta.hook,
|
|
227
|
+
environment: meta.environment,
|
|
228
|
+
plugin: meta.plugin,
|
|
229
|
+
source: meta.source
|
|
230
|
+
},
|
|
231
|
+
message: (0, _stryke_type_checks_is_set_string.isSetString)(message) ? message : message.message
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
204
236
|
//#endregion
|
|
205
237
|
//#region schemas/fs.ts
|
|
206
238
|
var FileMetadata_KeyValuePair = class extends _stryke_capnp.Struct {
|
|
@@ -1018,9 +1050,9 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1018
1050
|
*/
|
|
1019
1051
|
#context;
|
|
1020
1052
|
/**
|
|
1021
|
-
* The file system's
|
|
1053
|
+
* The file system's logger client utility.
|
|
1022
1054
|
*/
|
|
1023
|
-
#
|
|
1055
|
+
#logger;
|
|
1024
1056
|
/**
|
|
1025
1057
|
* Normalizes a given module id by resolving it against the built-ins path.
|
|
1026
1058
|
*
|
|
@@ -1234,7 +1266,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1234
1266
|
}
|
|
1235
1267
|
}));
|
|
1236
1268
|
} else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(FileSystem));
|
|
1237
|
-
result.#
|
|
1269
|
+
result.#logger.debug("Successfully completed virtual file system (VFS) initialization.");
|
|
1238
1270
|
return result;
|
|
1239
1271
|
}
|
|
1240
1272
|
/**
|
|
@@ -1268,7 +1300,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1268
1300
|
}
|
|
1269
1301
|
});
|
|
1270
1302
|
} else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(FileSystem));
|
|
1271
|
-
result.#
|
|
1303
|
+
result.#logger.debug("Successfully completed virtual file system (VFS) initialization.");
|
|
1272
1304
|
return result;
|
|
1273
1305
|
}
|
|
1274
1306
|
/**
|
|
@@ -1402,7 +1434,10 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1402
1434
|
return ret;
|
|
1403
1435
|
}, {});
|
|
1404
1436
|
}
|
|
1405
|
-
this.#
|
|
1437
|
+
this.#logger = context.extendLogger({
|
|
1438
|
+
source: "VFS",
|
|
1439
|
+
category: "fs"
|
|
1440
|
+
});
|
|
1406
1441
|
}
|
|
1407
1442
|
/**
|
|
1408
1443
|
* Asynchronously checks if a file exists in the virtual file system (VFS).
|
|
@@ -1529,7 +1564,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1529
1564
|
listSync(path) {
|
|
1530
1565
|
let resolvedPath = path;
|
|
1531
1566
|
if (resolvedPath.includes("*")) {
|
|
1532
|
-
this.#
|
|
1567
|
+
this.#logger.warn(`Invoking "listSync" with a glob pattern is not supported. It is likely you meant to use "globSync". Path: ${path}`);
|
|
1533
1568
|
resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
|
|
1534
1569
|
}
|
|
1535
1570
|
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));
|
|
@@ -1543,7 +1578,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1543
1578
|
async list(path) {
|
|
1544
1579
|
let resolvedPath = path;
|
|
1545
1580
|
if (resolvedPath.includes("*")) {
|
|
1546
|
-
this.#
|
|
1581
|
+
this.#logger.warn(`Invoking "list" with a glob pattern is not supported. It is likely you meant to use "glob". Path: ${path}`);
|
|
1547
1582
|
resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
|
|
1548
1583
|
}
|
|
1549
1584
|
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));
|
|
@@ -1555,7 +1590,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1555
1590
|
*/
|
|
1556
1591
|
async remove(path) {
|
|
1557
1592
|
const normalizedPath = this.#normalizePath(path);
|
|
1558
|
-
this.#
|
|
1593
|
+
this.#logger.trace(`Removing file: ${normalizedPath}`);
|
|
1559
1594
|
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1560
1595
|
if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) await adapter.remove(relativeKey);
|
|
1561
1596
|
else await adapter.clear(relativeKey);
|
|
@@ -1573,7 +1608,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1573
1608
|
*/
|
|
1574
1609
|
removeSync(path) {
|
|
1575
1610
|
const normalizedPath = this.#normalizePath(path);
|
|
1576
|
-
this.#
|
|
1611
|
+
this.#logger.trace(`Removing file: ${normalizedPath}`);
|
|
1577
1612
|
const { relativeKey, adapter } = this.#getStorage(normalizedPath);
|
|
1578
1613
|
if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) adapter.removeSync(relativeKey);
|
|
1579
1614
|
else adapter.clearSync(relativeKey);
|
|
@@ -1719,7 +1754,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1719
1754
|
const filePath = await this.resolve(path, void 0, { isFile: true });
|
|
1720
1755
|
if (!filePath || !this.existsSync(filePath)) return;
|
|
1721
1756
|
const { adapter } = this.#getStorage(filePath);
|
|
1722
|
-
this.#
|
|
1757
|
+
this.#logger.trace(`Reading ${adapter.name} file: ${filePath}`);
|
|
1723
1758
|
return await adapter.get(filePath) ?? void 0;
|
|
1724
1759
|
}
|
|
1725
1760
|
/**
|
|
@@ -1732,7 +1767,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1732
1767
|
const filePath = this.resolveSync(path, void 0, { isFile: true });
|
|
1733
1768
|
if (!filePath || !this.existsSync(filePath)) return;
|
|
1734
1769
|
const { adapter } = this.#getStorage(filePath);
|
|
1735
|
-
this.#
|
|
1770
|
+
this.#logger.trace(`Reading ${adapter.name} file: ${filePath}`);
|
|
1736
1771
|
return adapter.getSync(filePath) ?? void 0;
|
|
1737
1772
|
}
|
|
1738
1773
|
/**
|
|
@@ -1747,15 +1782,15 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1747
1782
|
const meta = options.meta ?? {};
|
|
1748
1783
|
const resolvedPath = await this.resolve(this.#normalizePath(path)) || path;
|
|
1749
1784
|
const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
|
|
1750
|
-
this.#
|
|
1785
|
+
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)})`);
|
|
1751
1786
|
let code = data;
|
|
1752
1787
|
try {
|
|
1753
1788
|
if (!options.skipFormat) code = await (0, _powerlines_core_lib_utilities_format.format)(this.#context, resolvedPath, data);
|
|
1754
1789
|
} catch (err) {
|
|
1755
|
-
if (DEFAULT_EXTENSIONS.includes((0, _stryke_path_file_path_fns.findFileExtensionSafe)(resolvedPath, { fullExtension: true }))) this.#
|
|
1790
|
+
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}`);
|
|
1756
1791
|
code = data;
|
|
1757
1792
|
}
|
|
1758
|
-
this.#
|
|
1793
|
+
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)})`);
|
|
1759
1794
|
const id = this.#normalizeId(meta.id || resolvedPath);
|
|
1760
1795
|
this.metadata[id] = {
|
|
1761
1796
|
type: "normal",
|
|
@@ -1778,7 +1813,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1778
1813
|
const meta = options.meta ?? {};
|
|
1779
1814
|
const resolvedPath = this.resolveSync(this.#normalizePath(path)) || path;
|
|
1780
1815
|
const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
|
|
1781
|
-
this.#
|
|
1816
|
+
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)})`);
|
|
1782
1817
|
const id = this.#normalizeId(meta.id || resolvedPath);
|
|
1783
1818
|
this.metadata[id] = {
|
|
1784
1819
|
type: "normal",
|
|
@@ -1942,7 +1977,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1942
1977
|
async dispose() {
|
|
1943
1978
|
if (!this.#isDisposed) {
|
|
1944
1979
|
this.#isDisposed = true;
|
|
1945
|
-
this.#
|
|
1980
|
+
this.#logger.debug("Disposing virtual file system...");
|
|
1946
1981
|
await this.remove((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"));
|
|
1947
1982
|
const message = new _stryke_capnp.Message();
|
|
1948
1983
|
const fs = message.initRoot(FileSystem);
|
|
@@ -1977,9 +2012,15 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1977
2012
|
await (0, _stryke_fs_buffer.writeFileBuffer)((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
|
|
1978
2013
|
if (!this.#context.config.skipCache) this.resolverCache.save(true);
|
|
1979
2014
|
await Promise.all(this.#getStorages().map(async (storage) => storage.adapter.dispose()));
|
|
1980
|
-
this.#
|
|
2015
|
+
this.#logger.trace("Virtual file system has been disposed.");
|
|
1981
2016
|
}
|
|
1982
2017
|
}
|
|
2018
|
+
/**
|
|
2019
|
+
* Asynchronously disposes of the virtual file system (VFS) by saving its state to disk.
|
|
2020
|
+
*
|
|
2021
|
+
* @remarks
|
|
2022
|
+
* This method is automatically called when the VFS instance is used within a `using` block, or can be manually invoked to ensure that the VFS state is saved and resources are cleaned up properly.
|
|
2023
|
+
*/
|
|
1983
2024
|
async [Symbol.asyncDispose]() {
|
|
1984
2025
|
return this.dispose();
|
|
1985
2026
|
}
|
|
@@ -2152,7 +2193,6 @@ function createResolver(options) {
|
|
|
2152
2193
|
//#region src/context/base-context.ts
|
|
2153
2194
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
2154
2195
|
#timestamp = Date.now();
|
|
2155
|
-
#logLevel = "info";
|
|
2156
2196
|
/**
|
|
2157
2197
|
* The path to the Powerlines package
|
|
2158
2198
|
*/
|
|
@@ -2174,27 +2214,22 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2174
2214
|
*/
|
|
2175
2215
|
configFile;
|
|
2176
2216
|
/**
|
|
2217
|
+
* 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.
|
|
2218
|
+
*/
|
|
2219
|
+
get logger() {
|
|
2220
|
+
return this.createLogger({
|
|
2221
|
+
...this.configFile.config,
|
|
2222
|
+
...this.options
|
|
2223
|
+
});
|
|
2224
|
+
}
|
|
2225
|
+
/**
|
|
2177
2226
|
* A timestamp representing when the context was initialized
|
|
2178
2227
|
*/
|
|
2179
2228
|
get timestamp() {
|
|
2180
|
-
return
|
|
2229
|
+
return this.#timestamp;
|
|
2181
2230
|
}
|
|
2182
2231
|
get logLevel() {
|
|
2183
|
-
return this
|
|
2184
|
-
}
|
|
2185
|
-
set logLevel(level) {
|
|
2186
|
-
this.#logLevel = level;
|
|
2187
|
-
}
|
|
2188
|
-
/**
|
|
2189
|
-
* The logger function
|
|
2190
|
-
*/
|
|
2191
|
-
get log() {
|
|
2192
|
-
const level = this.logLevel || "info";
|
|
2193
|
-
if (!this.logger || this.logger.level !== level) this.logger = {
|
|
2194
|
-
log: this.createLog(),
|
|
2195
|
-
level
|
|
2196
|
-
};
|
|
2197
|
-
return this.logger.log;
|
|
2232
|
+
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(this.options.logLevel, this.options.mode);
|
|
2198
2233
|
}
|
|
2199
2234
|
/**
|
|
2200
2235
|
* The environment paths for the project
|
|
@@ -2225,7 +2260,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2225
2260
|
* @param message - The message to log.
|
|
2226
2261
|
*/
|
|
2227
2262
|
fatal(message) {
|
|
2228
|
-
this.
|
|
2263
|
+
this.logger.error((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2229
2264
|
}
|
|
2230
2265
|
/**
|
|
2231
2266
|
* A logging function for error messages
|
|
@@ -2233,7 +2268,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2233
2268
|
* @param message - The message to log.
|
|
2234
2269
|
*/
|
|
2235
2270
|
error(message) {
|
|
2236
|
-
this.
|
|
2271
|
+
this.logger.error((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2237
2272
|
}
|
|
2238
2273
|
/**
|
|
2239
2274
|
* A logging function for warning messages
|
|
@@ -2241,7 +2276,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2241
2276
|
* @param message - The message to log.
|
|
2242
2277
|
*/
|
|
2243
2278
|
warn(message) {
|
|
2244
|
-
this.
|
|
2279
|
+
this.logger.warn((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2245
2280
|
}
|
|
2246
2281
|
/**
|
|
2247
2282
|
* A logging function for informational messages
|
|
@@ -2249,7 +2284,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2249
2284
|
* @param message - The message to log.
|
|
2250
2285
|
*/
|
|
2251
2286
|
info(message) {
|
|
2252
|
-
this.
|
|
2287
|
+
this.logger.info((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2253
2288
|
}
|
|
2254
2289
|
/**
|
|
2255
2290
|
* A logging function for debug messages
|
|
@@ -2257,7 +2292,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2257
2292
|
* @param message - The message to log.
|
|
2258
2293
|
*/
|
|
2259
2294
|
debug(message) {
|
|
2260
|
-
this.
|
|
2295
|
+
this.logger.debug((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2261
2296
|
}
|
|
2262
2297
|
/**
|
|
2263
2298
|
* A logging function for trace messages
|
|
@@ -2265,7 +2300,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2265
2300
|
* @param message - The message to log.
|
|
2266
2301
|
*/
|
|
2267
2302
|
trace(message) {
|
|
2268
|
-
this.
|
|
2303
|
+
this.logger.trace((0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
2269
2304
|
}
|
|
2270
2305
|
/**
|
|
2271
2306
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
@@ -2285,35 +2320,31 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2285
2320
|
const startDuration = performance.now();
|
|
2286
2321
|
return () => {
|
|
2287
2322
|
const duration = performance.now() - startDuration;
|
|
2288
|
-
this.
|
|
2323
|
+
this.logger.info({
|
|
2324
|
+
meta: { category: "performance" },
|
|
2325
|
+
message: `${chalk.default.bold.cyanBright(name)} completed in ${chalk.default.bold.cyanBright(duration < 1e3 ? `${duration.toFixed(2)} milliseconds` : (0, date_fns_formatDistanceToNowStrict.formatDistanceToNowStrict)(startDate))}`
|
|
2326
|
+
});
|
|
2289
2327
|
};
|
|
2290
2328
|
}
|
|
2291
2329
|
/**
|
|
2292
2330
|
* Create a new logger instance
|
|
2293
2331
|
*
|
|
2294
|
-
* @param
|
|
2295
|
-
* @returns A logger
|
|
2332
|
+
* @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.
|
|
2333
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2296
2334
|
*/
|
|
2297
|
-
|
|
2298
|
-
return (0,
|
|
2299
|
-
...this.options,
|
|
2300
|
-
logLevel: (0, _stryke_type_checks_is_null.isNull)(this.logLevel) ? "silent" : this.logLevel
|
|
2301
|
-
});
|
|
2335
|
+
createLogger(options, callback) {
|
|
2336
|
+
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.framework || "powerlines", options, callback);
|
|
2302
2337
|
}
|
|
2303
2338
|
/**
|
|
2304
|
-
* Extend the
|
|
2339
|
+
* Extend the base logger with additional configuration options
|
|
2305
2340
|
*
|
|
2306
|
-
* @param
|
|
2307
|
-
* @returns A logger
|
|
2341
|
+
* @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.
|
|
2342
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
2308
2343
|
*/
|
|
2309
|
-
|
|
2310
|
-
return (0,
|
|
2344
|
+
extendLogger(options) {
|
|
2345
|
+
return (0, _powerlines_core_plugin_utils_logging.extendLogger)(this.logger, options);
|
|
2311
2346
|
}
|
|
2312
2347
|
/**
|
|
2313
|
-
* A logger function specific to this context
|
|
2314
|
-
*/
|
|
2315
|
-
logger;
|
|
2316
|
-
/**
|
|
2317
2348
|
* Initialize the context with the provided configuration options
|
|
2318
2349
|
*
|
|
2319
2350
|
* @remarks
|
|
@@ -2322,7 +2353,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2322
2353
|
* @param options - The configuration options to initialize the context with
|
|
2323
2354
|
*/
|
|
2324
2355
|
async init(options = {}) {
|
|
2325
|
-
this.inputOptions = options;
|
|
2356
|
+
this.inputOptions = { ...options };
|
|
2326
2357
|
if (!this.powerlinesPath) {
|
|
2327
2358
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
2328
2359
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
@@ -2334,6 +2365,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2334
2365
|
root,
|
|
2335
2366
|
cwd,
|
|
2336
2367
|
mode: options.mode,
|
|
2368
|
+
logLevel: options.logLevel,
|
|
2337
2369
|
framework: options.framework,
|
|
2338
2370
|
organization: options.organization,
|
|
2339
2371
|
configFile: options.configFile
|
|
@@ -2495,7 +2527,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2495
2527
|
buildId: this.#buildId,
|
|
2496
2528
|
releaseId: this.#releaseId,
|
|
2497
2529
|
checksum: this.#checksum,
|
|
2498
|
-
timestamp: this.timestamp
|
|
2530
|
+
timestamp: this.timestamp,
|
|
2499
2531
|
rootHash: (0, _stryke_hash.murmurhash)({
|
|
2500
2532
|
workspaceRoot: this.options?.cwd,
|
|
2501
2533
|
root: this.config?.root
|
|
@@ -2599,6 +2631,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2599
2631
|
}, {}) : this.config.resolve.alias : {});
|
|
2600
2632
|
}
|
|
2601
2633
|
/**
|
|
2634
|
+
* 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.
|
|
2635
|
+
*/
|
|
2636
|
+
get logger() {
|
|
2637
|
+
const options = {
|
|
2638
|
+
...this.config,
|
|
2639
|
+
...this.options
|
|
2640
|
+
};
|
|
2641
|
+
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)));
|
|
2642
|
+
if (this.config.customLogger) return (0, _powerlines_core_plugin_utils.withCustomLogger)(logger, this.config.customLogger);
|
|
2643
|
+
return logger;
|
|
2644
|
+
}
|
|
2645
|
+
/**
|
|
2602
2646
|
* Gets the parser cache.
|
|
2603
2647
|
*/
|
|
2604
2648
|
get parserCache() {
|
|
@@ -2695,6 +2739,9 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2695
2739
|
headers: cached.headers
|
|
2696
2740
|
});
|
|
2697
2741
|
}
|
|
2742
|
+
const logger = this.extendLogger({ category: "network" });
|
|
2743
|
+
const startTime = Date.now();
|
|
2744
|
+
logger.trace(`Sending fetch request (${options.method?.toUpperCase() || "GET"}): ${input.toString()}`);
|
|
2698
2745
|
const response = await (0, _stryke_http_fetch.fetchRequest)(input, {
|
|
2699
2746
|
timeout: 12e3,
|
|
2700
2747
|
...options
|
|
@@ -2708,6 +2755,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2708
2755
|
if (!this.config.skipCache && !options.skipCache) try {
|
|
2709
2756
|
this.requestCache.set(cacheKey, result);
|
|
2710
2757
|
} catch {}
|
|
2758
|
+
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]"}`);
|
|
2711
2759
|
return new undici.Response(result.body, {
|
|
2712
2760
|
status: result.status,
|
|
2713
2761
|
statusText: result.statusText,
|
|
@@ -3062,6 +3110,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3062
3110
|
*/
|
|
3063
3111
|
async init(options = {}) {
|
|
3064
3112
|
await super.init(options);
|
|
3113
|
+
this.options.executionId = options.executionId ?? this.options.executionId;
|
|
3065
3114
|
this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
|
|
3066
3115
|
const projectJsonPath = (0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root, "project.json");
|
|
3067
3116
|
if ((0, _stryke_fs_exists.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs_json.readJsonFile)(projectJsonPath);
|
|
@@ -3082,6 +3131,13 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3082
3131
|
* Initialize the context with the provided configuration options
|
|
3083
3132
|
*/
|
|
3084
3133
|
async innerSetup() {
|
|
3134
|
+
const logger = this.extendLogger({ category: "config" });
|
|
3135
|
+
logger.debug(`Pre-setup Powerlines configuration object: \n${JSON.stringify({
|
|
3136
|
+
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3137
|
+
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3138
|
+
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
3139
|
+
pluginConfig: this.config.pluginConfig ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : {}
|
|
3140
|
+
}, null, 2)}`);
|
|
3085
3141
|
if (!this.inputOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
3086
3142
|
this.options.mode = "production";
|
|
3087
3143
|
this.config.mode = "production";
|
|
@@ -3091,10 +3147,6 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3091
3147
|
this.config.framework = "powerlines";
|
|
3092
3148
|
}
|
|
3093
3149
|
this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
3094
|
-
this.logger = {
|
|
3095
|
-
log: this.createLog(this.config.name),
|
|
3096
|
-
level: (0, _stryke_type_checks_is_null.isNull)(this.logLevel) ? "silent" : this.logLevel
|
|
3097
|
-
};
|
|
3098
3150
|
this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
|
|
3099
3151
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
3100
3152
|
this.config.title ??= (0, _stryke_string_format_title_case.titleCase)(this.config.name);
|
|
@@ -3107,11 +3159,12 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3107
3159
|
ret.push(plugin);
|
|
3108
3160
|
return ret;
|
|
3109
3161
|
}, []);
|
|
3110
|
-
if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel =
|
|
3111
|
-
else this.config.logLevel =
|
|
3112
|
-
|
|
3162
|
+
if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
3163
|
+
else if (this.config.mode === "test") this.config.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
|
|
3164
|
+
else this.config.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
3165
|
+
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
3113
3166
|
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);
|
|
3114
|
-
this.resolvedConfig.output = (0, defu.default)(this.
|
|
3167
|
+
this.resolvedConfig.output = (0, defu.default)(this.config.output ?? {}, {
|
|
3115
3168
|
path: (0, _stryke_path_join.joinPaths)(this.config.root, "dist"),
|
|
3116
3169
|
copy: { assets: [
|
|
3117
3170
|
{ glob: "LICENSE" },
|
|
@@ -3156,6 +3209,12 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3156
3209
|
}));
|
|
3157
3210
|
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;
|
|
3158
3211
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
3212
|
+
logger.debug(`Post-setup Powerlines configuration object: \n${JSON.stringify({
|
|
3213
|
+
...(0, _stryke_helpers_omit.omit)(this.config, ["plugins"]),
|
|
3214
|
+
userConfig: this.config.userConfig ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : {},
|
|
3215
|
+
inlineConfig: this.config.inlineConfig ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : {},
|
|
3216
|
+
pluginConfig: this.config.pluginConfig ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : {}
|
|
3217
|
+
}, null, 2)}`);
|
|
3159
3218
|
}
|
|
3160
3219
|
};
|
|
3161
3220
|
|
|
@@ -3205,7 +3264,7 @@ function mergeConfigs(currentResult, previousResults) {
|
|
|
3205
3264
|
async function callHook(context, key, options, ...args) {
|
|
3206
3265
|
const hooks = context.selectHooks(key, options);
|
|
3207
3266
|
if (hooks.length > 0) {
|
|
3208
|
-
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,
|
|
3267
|
+
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")}`);
|
|
3209
3268
|
const invokeHook = async (hook, hookArgs) => {
|
|
3210
3269
|
return Reflect.apply(hook.handler, hook.context, hookArgs);
|
|
3211
3270
|
};
|
|
@@ -3305,7 +3364,7 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3305
3364
|
const normalizeMessage = (message) => {
|
|
3306
3365
|
return (0, _stryke_type_checks_is_string.isString)(message) ? message : message.message;
|
|
3307
3366
|
};
|
|
3308
|
-
const
|
|
3367
|
+
const logger = environment.extendLogger({ plugin: plugin.name.replaceAll(":", " - ") });
|
|
3309
3368
|
const callHookFn = async (hook, options, ...args) => {
|
|
3310
3369
|
return environment.$$internal.api.callHook(hook, {
|
|
3311
3370
|
sequential: true,
|
|
@@ -3324,24 +3383,24 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3324
3383
|
meta
|
|
3325
3384
|
};
|
|
3326
3385
|
if (prop === "id") return pluginId;
|
|
3327
|
-
if (prop === "
|
|
3386
|
+
if (prop === "logger") return logger;
|
|
3328
3387
|
if (prop === "fatal") return (message) => {
|
|
3329
|
-
|
|
3388
|
+
logger.error(normalizeMessage(message));
|
|
3330
3389
|
};
|
|
3331
3390
|
if (prop === "error") return (message) => {
|
|
3332
|
-
|
|
3391
|
+
logger.error(normalizeMessage(message));
|
|
3333
3392
|
};
|
|
3334
3393
|
if (prop === "warn") return (message) => {
|
|
3335
|
-
|
|
3394
|
+
logger.warn(normalizeMessage(message));
|
|
3336
3395
|
};
|
|
3337
3396
|
if (prop === "info") return (message) => {
|
|
3338
|
-
|
|
3397
|
+
logger.info(normalizeMessage(message));
|
|
3339
3398
|
};
|
|
3340
3399
|
if (prop === "debug") return (message) => {
|
|
3341
|
-
|
|
3400
|
+
logger.debug(normalizeMessage(message));
|
|
3342
3401
|
};
|
|
3343
3402
|
if (prop === "trace") return (message) => {
|
|
3344
|
-
|
|
3403
|
+
logger.trace(normalizeMessage(message));
|
|
3345
3404
|
};
|
|
3346
3405
|
return environment[prop];
|
|
3347
3406
|
},
|
|
@@ -3360,7 +3419,7 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3360
3419
|
"addPlugin",
|
|
3361
3420
|
"selectHooks"
|
|
3362
3421
|
].includes(prop)) {
|
|
3363
|
-
|
|
3422
|
+
logger.warn(`Cannot set the read-only "${String(prop)}" property`);
|
|
3364
3423
|
return false;
|
|
3365
3424
|
}
|
|
3366
3425
|
environment[prop] = value;
|
|
@@ -3414,50 +3473,26 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
3414
3473
|
/**
|
|
3415
3474
|
* Create a new logger instance
|
|
3416
3475
|
*
|
|
3417
|
-
* @param
|
|
3418
|
-
* @returns A logger
|
|
3419
|
-
*/
|
|
3420
|
-
|
|
3421
|
-
return (
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
executionId: this.options.executionId,
|
|
3426
|
-
executionIndex: this.options.executionIndex,
|
|
3427
|
-
timestamp: Date.now(),
|
|
3428
|
-
payload: {
|
|
3429
|
-
level,
|
|
3430
|
-
source,
|
|
3431
|
-
environment: this.environment?.name,
|
|
3432
|
-
args
|
|
3433
|
-
}
|
|
3434
|
-
});
|
|
3435
|
-
};
|
|
3476
|
+
* @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.
|
|
3477
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3478
|
+
*/
|
|
3479
|
+
createLogger(options, callback) {
|
|
3480
|
+
return super.createLogger({
|
|
3481
|
+
...options,
|
|
3482
|
+
environment: this.environment?.name
|
|
3483
|
+
}, callback);
|
|
3436
3484
|
}
|
|
3437
3485
|
/**
|
|
3438
|
-
* Extend the
|
|
3439
|
-
*
|
|
3440
|
-
* @param
|
|
3441
|
-
* @
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
type: "write-log",
|
|
3449
|
-
executionId: this.options.executionId,
|
|
3450
|
-
executionIndex: this.options.executionIndex,
|
|
3451
|
-
timestamp: Date.now(),
|
|
3452
|
-
payload: {
|
|
3453
|
-
level,
|
|
3454
|
-
source,
|
|
3455
|
-
plugin,
|
|
3456
|
-
environment: this.environment?.name,
|
|
3457
|
-
args
|
|
3458
|
-
}
|
|
3459
|
-
});
|
|
3460
|
-
};
|
|
3486
|
+
* Extend the base logger with additional configuration options
|
|
3487
|
+
*
|
|
3488
|
+
* @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.
|
|
3489
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
3490
|
+
*/
|
|
3491
|
+
extendLogger(options) {
|
|
3492
|
+
return super.extendLogger({
|
|
3493
|
+
...options,
|
|
3494
|
+
environment: this.environment?.name
|
|
3495
|
+
});
|
|
3461
3496
|
}
|
|
3462
3497
|
/**
|
|
3463
3498
|
* 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.
|
|
@@ -3643,29 +3678,28 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
3643
3678
|
/**
|
|
3644
3679
|
* Create a new logger instance
|
|
3645
3680
|
*
|
|
3646
|
-
* @param
|
|
3647
|
-
* @returns A logger
|
|
3681
|
+
* @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.
|
|
3682
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3648
3683
|
*/
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
...
|
|
3652
|
-
|
|
3684
|
+
createLogger(options, callback) {
|
|
3685
|
+
return super.createLogger({
|
|
3686
|
+
...options,
|
|
3687
|
+
executionId: this.id,
|
|
3688
|
+
executionIndex: this.options.executionIndex
|
|
3689
|
+
}, callback);
|
|
3690
|
+
}
|
|
3691
|
+
/**
|
|
3692
|
+
* Extend the base logger with additional configuration options
|
|
3693
|
+
*
|
|
3694
|
+
* @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.
|
|
3695
|
+
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
3696
|
+
*/
|
|
3697
|
+
extendLogger(options) {
|
|
3698
|
+
return super.extendLogger({
|
|
3699
|
+
...options,
|
|
3700
|
+
executionId: this.id,
|
|
3701
|
+
executionIndex: this.options.executionIndex
|
|
3653
3702
|
});
|
|
3654
|
-
return (level, ...args) => {
|
|
3655
|
-
logger(level, ...args);
|
|
3656
|
-
process.send?.({
|
|
3657
|
-
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
3658
|
-
type: "write-log",
|
|
3659
|
-
executionId: this.id,
|
|
3660
|
-
executionIndex: this.options.executionIndex,
|
|
3661
|
-
timestamp: Date.now(),
|
|
3662
|
-
payload: {
|
|
3663
|
-
source,
|
|
3664
|
-
level,
|
|
3665
|
-
args
|
|
3666
|
-
}
|
|
3667
|
-
});
|
|
3668
|
-
};
|
|
3669
3703
|
}
|
|
3670
3704
|
/**
|
|
3671
3705
|
* 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.
|
|
@@ -4531,7 +4565,7 @@ ${formatTypes(code)}
|
|
|
4531
4565
|
const timer = api.context.timer("Initialization");
|
|
4532
4566
|
for (const plugin of api.context.config.plugins.flatMap((p) => (0, _stryke_convert_to_array.toArray)(p)) ?? []) await api.addPlugin(plugin);
|
|
4533
4567
|
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.");
|
|
4534
|
-
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,
|
|
4568
|
+
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")}`);
|
|
4535
4569
|
const pluginConfig = await api.callHook("config", {
|
|
4536
4570
|
environment: await api.context.getEnvironment(),
|
|
4537
4571
|
sequential: true,
|
|
@@ -4871,44 +4905,28 @@ ${formatTypes(code)}
|
|
|
4871
4905
|
//#endregion
|
|
4872
4906
|
//#region src/_internal/worker.ts
|
|
4873
4907
|
async function clean({ options, config }) {
|
|
4874
|
-
|
|
4875
|
-
await execution.clean(config);
|
|
4876
|
-
await execution.finalize();
|
|
4908
|
+
await (await PowerlinesExecution.fromConfig(options, config)).clean(config);
|
|
4877
4909
|
}
|
|
4878
4910
|
async function prepare({ options, config }) {
|
|
4879
|
-
|
|
4880
|
-
await execution.prepare(config);
|
|
4881
|
-
await execution.finalize();
|
|
4911
|
+
await (await PowerlinesExecution.fromConfig(options, config)).prepare(config);
|
|
4882
4912
|
}
|
|
4883
4913
|
async function types({ options, config }) {
|
|
4884
|
-
|
|
4885
|
-
await execution.types(config);
|
|
4886
|
-
await execution.finalize();
|
|
4914
|
+
await (await PowerlinesExecution.fromConfig(options, config)).types(config);
|
|
4887
4915
|
}
|
|
4888
4916
|
async function lint({ options, config }) {
|
|
4889
|
-
|
|
4890
|
-
await execution.lint(config);
|
|
4891
|
-
await execution.finalize();
|
|
4917
|
+
await (await PowerlinesExecution.fromConfig(options, config)).lint(config);
|
|
4892
4918
|
}
|
|
4893
4919
|
async function test({ options, config }) {
|
|
4894
|
-
|
|
4895
|
-
await execution.test(config);
|
|
4896
|
-
await execution.finalize();
|
|
4920
|
+
await (await PowerlinesExecution.fromConfig(options, config)).test(config);
|
|
4897
4921
|
}
|
|
4898
4922
|
async function build({ options, config }) {
|
|
4899
|
-
|
|
4900
|
-
await execution.build(config);
|
|
4901
|
-
await execution.finalize();
|
|
4923
|
+
await (await PowerlinesExecution.fromConfig(options, config)).build(config);
|
|
4902
4924
|
}
|
|
4903
4925
|
async function docs({ options, config }) {
|
|
4904
|
-
|
|
4905
|
-
await execution.docs(config);
|
|
4906
|
-
await execution.finalize();
|
|
4926
|
+
await (await PowerlinesExecution.fromConfig(options, config)).docs(config);
|
|
4907
4927
|
}
|
|
4908
4928
|
async function deploy({ options, config }) {
|
|
4909
|
-
|
|
4910
|
-
await execution.deploy(config);
|
|
4911
|
-
await execution.finalize();
|
|
4929
|
+
await (await PowerlinesExecution.fromConfig(options, config)).deploy(config);
|
|
4912
4930
|
}
|
|
4913
4931
|
|
|
4914
4932
|
//#endregion
|