@powerlines/engine 0.44.9 → 0.44.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/worker.cjs +136 -61
- package/dist/_internal/worker.mjs +137 -62
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +5 -10
- package/dist/api.d.cts +3 -3
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +3 -3
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +5 -10
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-fOM4ZWUo.mjs → base-context-C6yzgs6K.mjs} +50 -21
- package/dist/base-context-C6yzgs6K.mjs.map +1 -0
- package/dist/{base-context-CAA1druQ.cjs → base-context-trNQZNsX.cjs} +49 -20
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +50 -17
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +50 -17
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-BWGxMU_n.mjs → engine-context-C-11i43N.mjs} +2 -2
- package/dist/{engine-context-BWGxMU_n.mjs.map → engine-context-C-11i43N.mjs.map} +1 -1
- package/dist/{engine-context-CUPubmrM.cjs → engine-context-D1_U6xVC.cjs} +1 -1
- package/dist/{execution-context-BVn7D0Ax.cjs → execution-context-C-M-Mxse.cjs} +87 -42
- package/dist/{execution-context-UJPngOZR.mjs → execution-context-D9Enw3J5.mjs} +89 -44
- package/dist/execution-context-D9Enw3J5.mjs.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/base-context-fOM4ZWUo.mjs.map +0 -1
- package/dist/execution-context-UJPngOZR.mjs.map +0 -1
|
@@ -69,6 +69,8 @@ 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
71
|
let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
|
|
72
|
+
let _stryke_convert_to_bool = require("@stryke/convert/to-bool");
|
|
73
|
+
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
72
74
|
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
73
75
|
let _stryke_hash = require("@stryke/hash");
|
|
74
76
|
let _stryke_hash_node = require("@stryke/hash/node");
|
|
@@ -102,9 +104,9 @@ let node_path = require("node:path");
|
|
|
102
104
|
let typescript = require("typescript");
|
|
103
105
|
typescript = __toESM(typescript, 1);
|
|
104
106
|
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
105
|
-
let
|
|
107
|
+
let _storm_software_config_tools_get_config = require("@storm-software/config-tools/get-config");
|
|
108
|
+
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
106
109
|
let _stryke_fs = require("@stryke/fs");
|
|
107
|
-
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
108
110
|
let _stryke_path = require("@stryke/path");
|
|
109
111
|
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
110
112
|
let jiti = require("jiti");
|
|
@@ -112,6 +114,7 @@ let _stryke_helpers_get_field = require("@stryke/helpers/get-field");
|
|
|
112
114
|
let ts_morph = require("ts-morph");
|
|
113
115
|
let _stryke_string_format_package = require("@stryke/string-format/package");
|
|
114
116
|
let _donedeal0_superdiff = require("@donedeal0/superdiff");
|
|
117
|
+
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
115
118
|
|
|
116
119
|
//#region src/_internal/helpers/environment.ts
|
|
117
120
|
function createEnvironment(name, config = {}) {
|
|
@@ -199,34 +202,34 @@ async function writeMetaFile(context) {
|
|
|
199
202
|
|
|
200
203
|
//#endregion
|
|
201
204
|
//#region src/_internal/ipc/send.ts
|
|
202
|
-
function sendWriteLogMessage(context,
|
|
203
|
-
const
|
|
204
|
-
...
|
|
205
|
-
...
|
|
205
|
+
function sendWriteLogMessage(context, meta, message) {
|
|
206
|
+
const combinedMeta = {
|
|
207
|
+
...context.logger.options,
|
|
208
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(meta) ? meta : { type: meta }
|
|
206
209
|
};
|
|
207
210
|
process.send?.({
|
|
208
211
|
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
209
212
|
type: "write-log",
|
|
210
|
-
executionId:
|
|
211
|
-
executionIndex:
|
|
212
|
-
environment:
|
|
213
|
+
executionId: combinedMeta.executionId || context.config.executionId,
|
|
214
|
+
executionIndex: combinedMeta.executionIndex ?? context.config.executionIndex,
|
|
215
|
+
environment: combinedMeta.environment,
|
|
213
216
|
timestamp: Date.now(),
|
|
214
217
|
payload: {
|
|
215
218
|
meta: {
|
|
216
|
-
type,
|
|
217
|
-
category:
|
|
218
|
-
logId:
|
|
219
|
-
timestamp:
|
|
220
|
-
name:
|
|
221
|
-
executionId:
|
|
222
|
-
executionIndex:
|
|
223
|
-
command:
|
|
224
|
-
hook:
|
|
225
|
-
environment:
|
|
226
|
-
plugin:
|
|
227
|
-
source:
|
|
219
|
+
type: combinedMeta.type,
|
|
220
|
+
category: combinedMeta.category || _powerlines_core.LogCategories.GENERAL,
|
|
221
|
+
logId: combinedMeta.logId || (0, _stryke_unique_id_uuid.uuid)(),
|
|
222
|
+
timestamp: combinedMeta.timestamp ?? Date.now(),
|
|
223
|
+
name: combinedMeta.name || context.config.name,
|
|
224
|
+
executionId: combinedMeta.executionId || context.config.executionId,
|
|
225
|
+
executionIndex: combinedMeta.executionIndex ?? context.config.executionIndex,
|
|
226
|
+
command: combinedMeta.command || context.config.command,
|
|
227
|
+
hook: combinedMeta.hook,
|
|
228
|
+
environment: combinedMeta.environment,
|
|
229
|
+
plugin: combinedMeta.plugin,
|
|
230
|
+
source: combinedMeta.source
|
|
228
231
|
},
|
|
229
|
-
message
|
|
232
|
+
message
|
|
230
233
|
}
|
|
231
234
|
});
|
|
232
235
|
}
|
|
@@ -2188,7 +2191,6 @@ function createResolver(options) {
|
|
|
2188
2191
|
//#region src/context/base-context.ts
|
|
2189
2192
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
2190
2193
|
#timestamp = Date.now();
|
|
2191
|
-
#name = "powerlines";
|
|
2192
2194
|
/**
|
|
2193
2195
|
* The path to the Powerlines package
|
|
2194
2196
|
*/
|
|
@@ -2213,10 +2215,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2213
2215
|
* 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.
|
|
2214
2216
|
*/
|
|
2215
2217
|
get logger() {
|
|
2216
|
-
return this.createLogger({
|
|
2217
|
-
...this.configFile.config,
|
|
2218
|
-
...this.options
|
|
2219
|
-
});
|
|
2218
|
+
return this.createLogger({});
|
|
2220
2219
|
}
|
|
2221
2220
|
/**
|
|
2222
2221
|
* A timestamp representing when the context was initialized
|
|
@@ -2256,7 +2255,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2256
2255
|
* @param message - The message to log.
|
|
2257
2256
|
*/
|
|
2258
2257
|
fatal(message) {
|
|
2259
|
-
this.logger.error(
|
|
2258
|
+
this.logger.error(message);
|
|
2260
2259
|
}
|
|
2261
2260
|
/**
|
|
2262
2261
|
* A logging function for error messages
|
|
@@ -2264,7 +2263,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2264
2263
|
* @param message - The message to log.
|
|
2265
2264
|
*/
|
|
2266
2265
|
error(message) {
|
|
2267
|
-
this.logger.error(
|
|
2266
|
+
this.logger.error(message);
|
|
2268
2267
|
}
|
|
2269
2268
|
/**
|
|
2270
2269
|
* A logging function for warning messages
|
|
@@ -2272,7 +2271,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2272
2271
|
* @param message - The message to log.
|
|
2273
2272
|
*/
|
|
2274
2273
|
warn(message) {
|
|
2275
|
-
this.logger.warn(
|
|
2274
|
+
this.logger.warn(message);
|
|
2276
2275
|
}
|
|
2277
2276
|
/**
|
|
2278
2277
|
* A logging function for informational messages
|
|
@@ -2280,7 +2279,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2280
2279
|
* @param message - The message to log.
|
|
2281
2280
|
*/
|
|
2282
2281
|
info(message) {
|
|
2283
|
-
this.logger.info(
|
|
2282
|
+
this.logger.info(message);
|
|
2284
2283
|
}
|
|
2285
2284
|
/**
|
|
2286
2285
|
* A logging function for debug messages
|
|
@@ -2288,7 +2287,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2288
2287
|
* @param message - The message to log.
|
|
2289
2288
|
*/
|
|
2290
2289
|
debug(message) {
|
|
2291
|
-
this.logger.debug(
|
|
2290
|
+
this.logger.debug(message);
|
|
2292
2291
|
}
|
|
2293
2292
|
/**
|
|
2294
2293
|
* A logging function for trace messages
|
|
@@ -2296,7 +2295,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2296
2295
|
* @param message - The message to log.
|
|
2297
2296
|
*/
|
|
2298
2297
|
trace(message) {
|
|
2299
|
-
this.logger.trace(
|
|
2298
|
+
this.logger.trace(message);
|
|
2300
2299
|
}
|
|
2301
2300
|
/**
|
|
2302
2301
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
@@ -2326,10 +2325,15 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2326
2325
|
* Create a new logger instance
|
|
2327
2326
|
*
|
|
2328
2327
|
* @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.
|
|
2328
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
2329
2329
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2330
2330
|
*/
|
|
2331
|
-
createLogger(options,
|
|
2332
|
-
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root,
|
|
2331
|
+
createLogger(options, logFn) {
|
|
2332
|
+
return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root, {
|
|
2333
|
+
...this.configFile.config,
|
|
2334
|
+
...this.options,
|
|
2335
|
+
...options
|
|
2336
|
+
}, logFn);
|
|
2333
2337
|
}
|
|
2334
2338
|
/**
|
|
2335
2339
|
* Extend the base logger with additional configuration options
|
|
@@ -2341,6 +2345,35 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2341
2345
|
return (0, _powerlines_core_plugin_utils_logging.extendLogger)(this.logger, options);
|
|
2342
2346
|
}
|
|
2343
2347
|
/**
|
|
2348
|
+
* Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.
|
|
2349
|
+
*
|
|
2350
|
+
* @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.
|
|
2351
|
+
*/
|
|
2352
|
+
async getWorkspaceConfig() {
|
|
2353
|
+
return (0, _storm_software_config_tools_get_config.tryGetWorkspaceConfig)(false, this.options || this.inputOptions ? {
|
|
2354
|
+
cwd: this.options?.root || this.inputOptions?.root ? (0, _stryke_path_append.appendPath)(this.options?.root || this.inputOptions?.root || ".", this.options?.cwd || this.inputOptions?.cwd) : void 0,
|
|
2355
|
+
workspaceRoot: this.options?.cwd || this.inputOptions?.cwd
|
|
2356
|
+
} : void 0);
|
|
2357
|
+
}
|
|
2358
|
+
/**
|
|
2359
|
+
* Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to "production".
|
|
2360
|
+
*
|
|
2361
|
+
* @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
|
|
2362
|
+
*/
|
|
2363
|
+
async getDefaultMode() {
|
|
2364
|
+
const workspaceConfig = await this.getWorkspaceConfig();
|
|
2365
|
+
return _stryke_env_environment_checks.isProduction ? "production" : _stryke_env_environment_checks.isDevelopment ? "development" : _stryke_env_environment_checks.isTest ? "test" : workspaceConfig?.mode || "production";
|
|
2366
|
+
}
|
|
2367
|
+
/**
|
|
2368
|
+
* Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to "info" for development mode and "warn" for production mode.
|
|
2369
|
+
*
|
|
2370
|
+
* @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
|
|
2371
|
+
*/
|
|
2372
|
+
async getDefaultLogLevel() {
|
|
2373
|
+
const workspaceConfig = await this.getWorkspaceConfig();
|
|
2374
|
+
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(workspaceConfig?.logLevel ? workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" ? "info" : workspaceConfig.logLevel === "all" ? "debug" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel : void 0, this.options?.mode || this.inputOptions?.mode || workspaceConfig?.mode || await this.getDefaultMode());
|
|
2375
|
+
}
|
|
2376
|
+
/**
|
|
2344
2377
|
* Initialize the context with the provided configuration options
|
|
2345
2378
|
*
|
|
2346
2379
|
* @remarks
|
|
@@ -2348,7 +2381,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2348
2381
|
*
|
|
2349
2382
|
* @param options - The configuration options to initialize the context with
|
|
2350
2383
|
*/
|
|
2351
|
-
async init(options
|
|
2384
|
+
async init(options) {
|
|
2352
2385
|
this.inputOptions = { ...options };
|
|
2353
2386
|
if (!this.powerlinesPath) {
|
|
2354
2387
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
@@ -2367,15 +2400,14 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
2367
2400
|
organization: options.organization,
|
|
2368
2401
|
configFile: options.configFile
|
|
2369
2402
|
}, this.options ?? {}, {
|
|
2370
|
-
mode:
|
|
2371
|
-
|
|
2403
|
+
mode: await this.getDefaultMode(),
|
|
2404
|
+
logLevel: await this.getDefaultLogLevel()
|
|
2372
2405
|
});
|
|
2373
2406
|
this.resolver = createResolver({
|
|
2374
2407
|
workspaceRoot: cwd,
|
|
2375
2408
|
root,
|
|
2376
2409
|
cacheDir: this.envPaths.cache,
|
|
2377
|
-
mode: this.options.mode
|
|
2378
|
-
logLevel: this.logLevel
|
|
2410
|
+
mode: this.options.mode
|
|
2379
2411
|
});
|
|
2380
2412
|
this.configFile = await (0, _powerlines_core_lib_config.loadUserConfigFile)(this.options, this.resolver);
|
|
2381
2413
|
if (!this.options.name) {
|
|
@@ -2653,18 +2685,45 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2653
2685
|
}, {}) : this.config.resolve.alias : {});
|
|
2654
2686
|
}
|
|
2655
2687
|
/**
|
|
2656
|
-
*
|
|
2688
|
+
* Create a new logger instance
|
|
2689
|
+
*
|
|
2690
|
+
* @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.
|
|
2691
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
2692
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2657
2693
|
*/
|
|
2658
|
-
|
|
2659
|
-
|
|
2694
|
+
createLogger(options, logFn) {
|
|
2695
|
+
let logger;
|
|
2696
|
+
if ((0, _stryke_convert_to_bool.toBool)(process.env.POWERLINES_WORKER_THREAD_EXECUTION)) logger = (0, _powerlines_core_plugin_utils.createLogger)(this.config.name, {
|
|
2697
|
+
...this.options,
|
|
2660
2698
|
...this.config,
|
|
2661
|
-
...
|
|
2662
|
-
};
|
|
2663
|
-
|
|
2664
|
-
|
|
2699
|
+
...options
|
|
2700
|
+
}, (meta, message) => sendWriteLogMessage(this, meta, message));
|
|
2701
|
+
else logger = (0, _powerlines_core_plugin_utils.createLogger)(this.config.name, {
|
|
2702
|
+
...this.options,
|
|
2703
|
+
...this.config,
|
|
2704
|
+
...options
|
|
2705
|
+
});
|
|
2706
|
+
if (this.config.customLogger) logger = (0, _powerlines_core_plugin_utils.withCustomLogger)(logger, this.config.customLogger);
|
|
2707
|
+
if (logFn) logger = (0, _powerlines_core_plugin_utils.withLogFn)(logger, logFn);
|
|
2665
2708
|
return logger;
|
|
2666
2709
|
}
|
|
2667
2710
|
/**
|
|
2711
|
+
* The log level for the context, which determines the minimum level of log messages that will be emitted by the logger. This is resolved based on the configuration options provided by the user, and can be set to different levels for development, production, and test environments. The log level can also be overridden by plugins or other parts of the build process to provide more granular control over logging output.
|
|
2712
|
+
*/
|
|
2713
|
+
get logLevel() {
|
|
2714
|
+
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(this.config.logLevel, this.config.mode);
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* The environment paths for the project, which provide the locations of various directories and files used by the Powerlines framework. These paths are resolved based on the organization ID, application ID, and workspace root directory, and can be used to access configuration files, cache directories, and other resources in a consistent manner.
|
|
2718
|
+
*/
|
|
2719
|
+
get envPaths() {
|
|
2720
|
+
return (0, _stryke_env_get_env_paths.getEnvPaths)({
|
|
2721
|
+
orgId: this.config.organization,
|
|
2722
|
+
appId: this.config.framework || "powerlines",
|
|
2723
|
+
workspaceRoot: this.config.cwd
|
|
2724
|
+
});
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2668
2727
|
* Gets the parser cache.
|
|
2669
2728
|
*/
|
|
2670
2729
|
get parserCache() {
|
|
@@ -3077,18 +3136,16 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3077
3136
|
*/
|
|
3078
3137
|
async setup() {
|
|
3079
3138
|
this.resolvedConfig = (0, _powerlines_core_plugin_utils.mergeConfig)({
|
|
3139
|
+
root: this.options.root,
|
|
3140
|
+
cwd: this.options.cwd,
|
|
3080
3141
|
inlineConfig: this.config.inlineConfig ?? {},
|
|
3081
3142
|
userConfig: this.config.userConfig ?? {},
|
|
3082
3143
|
pluginConfig: this.config.pluginConfig ?? {}
|
|
3083
|
-
},
|
|
3144
|
+
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
3084
3145
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
3085
3146
|
version: this.packageJson?.version,
|
|
3086
3147
|
description: this.packageJson?.description
|
|
3087
3148
|
}, {
|
|
3088
|
-
projectType: "application",
|
|
3089
|
-
platform: "neutral",
|
|
3090
|
-
logLevel: "info",
|
|
3091
|
-
preview: false,
|
|
3092
3149
|
environments: {},
|
|
3093
3150
|
resolve: {}
|
|
3094
3151
|
});
|
|
@@ -3130,7 +3187,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3130
3187
|
*
|
|
3131
3188
|
* @param options - The configuration options to initialize the context with
|
|
3132
3189
|
*/
|
|
3133
|
-
async init(options
|
|
3190
|
+
async init(options) {
|
|
3134
3191
|
await super.init(options);
|
|
3135
3192
|
this.options.executionId = options.executionId ?? this.options.executionId;
|
|
3136
3193
|
this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
|
|
@@ -3182,6 +3239,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3182
3239
|
this.options.framework = "powerlines";
|
|
3183
3240
|
this.config.framework = "powerlines";
|
|
3184
3241
|
}
|
|
3242
|
+
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
3243
|
+
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
3185
3244
|
this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
3186
3245
|
this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
|
|
3187
3246
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
@@ -3208,7 +3267,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
3208
3267
|
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;
|
|
3209
3268
|
else this.config.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.copy.path || (0, _stryke_path_join.joinPaths)("dist", this.config.root)), this.config.cwd);
|
|
3210
3269
|
}
|
|
3211
|
-
if (this.config.output.
|
|
3270
|
+
if (this.config.output.types !== false) this.config.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.userConfig?.output?.types || this.config.inlineConfig?.output?.types || this.config.pluginConfig?.output?.types || (0, _stryke_path_join.joinPaths)(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
3212
3271
|
if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(this.config.output.copy.assets.map((asset) => {
|
|
3213
3272
|
return {
|
|
3214
3273
|
glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
|
|
@@ -3383,10 +3442,17 @@ function extractHooks(context, hooks, plugin, key, parentKey) {
|
|
|
3383
3442
|
* @returns The proxied plugin context
|
|
3384
3443
|
*/
|
|
3385
3444
|
function createPluginContext(pluginId, plugin, environment) {
|
|
3445
|
+
const logger = environment.extendLogger({ plugin: plugin.name });
|
|
3386
3446
|
const normalizeMessage = (message) => {
|
|
3387
|
-
return
|
|
3447
|
+
return {
|
|
3448
|
+
meta: {
|
|
3449
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(message) ? message.meta : {},
|
|
3450
|
+
environment: environment.environment?.name,
|
|
3451
|
+
plugin: plugin.name
|
|
3452
|
+
},
|
|
3453
|
+
message: (0, _stryke_type_checks_is_string.isString)(message) ? message : message.message
|
|
3454
|
+
};
|
|
3388
3455
|
};
|
|
3389
|
-
const logger = environment.extendLogger({ plugin: plugin.name.replaceAll(":", " - ") });
|
|
3390
3456
|
const callHookFn = async (hook, options, ...args) => {
|
|
3391
3457
|
return environment.$$internal.api.callHook(hook, {
|
|
3392
3458
|
sequential: true,
|
|
@@ -3406,6 +3472,9 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
3406
3472
|
};
|
|
3407
3473
|
if (prop === "id") return pluginId;
|
|
3408
3474
|
if (prop === "logger") return logger;
|
|
3475
|
+
if (prop === "log") return (type, message) => {
|
|
3476
|
+
logger.log(type, normalizeMessage(message));
|
|
3477
|
+
};
|
|
3409
3478
|
if (prop === "fatal") return (message) => {
|
|
3410
3479
|
logger.error(normalizeMessage(message));
|
|
3411
3480
|
};
|
|
@@ -3496,13 +3565,14 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
3496
3565
|
* Create a new logger instance
|
|
3497
3566
|
*
|
|
3498
3567
|
* @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.
|
|
3568
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
3499
3569
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3500
3570
|
*/
|
|
3501
|
-
createLogger(options,
|
|
3571
|
+
createLogger(options, logFn) {
|
|
3502
3572
|
return super.createLogger({
|
|
3503
3573
|
...options,
|
|
3504
3574
|
environment: this.environment?.name
|
|
3505
|
-
},
|
|
3575
|
+
}, logFn);
|
|
3506
3576
|
}
|
|
3507
3577
|
/**
|
|
3508
3578
|
* Extend the base logger with additional configuration options
|
|
@@ -3535,7 +3605,11 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
3535
3605
|
this.resolvedConfig = (0, _powerlines_core_plugin_utils.mergeConfig)({
|
|
3536
3606
|
name: this.config.name,
|
|
3537
3607
|
title: this.config.title
|
|
3538
|
-
}, getConfigProps(
|
|
3608
|
+
}, getConfigProps({
|
|
3609
|
+
...this.environment,
|
|
3610
|
+
root: this.options.root,
|
|
3611
|
+
cwd: this.options.cwd
|
|
3612
|
+
}), this.config);
|
|
3539
3613
|
await this.innerSetup();
|
|
3540
3614
|
}
|
|
3541
3615
|
async addPlugin(plugin) {
|
|
@@ -3701,14 +3775,15 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
3701
3775
|
* Create a new logger instance
|
|
3702
3776
|
*
|
|
3703
3777
|
* @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.
|
|
3778
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
3704
3779
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
3705
3780
|
*/
|
|
3706
|
-
createLogger(options,
|
|
3781
|
+
createLogger(options, logFn) {
|
|
3707
3782
|
return super.createLogger({
|
|
3708
3783
|
...options,
|
|
3709
3784
|
executionId: this.id,
|
|
3710
3785
|
executionIndex: this.options.executionIndex
|
|
3711
|
-
},
|
|
3786
|
+
}, logFn);
|
|
3712
3787
|
}
|
|
3713
3788
|
/**
|
|
3714
3789
|
* Extend the base logger with additional configuration options
|