@powerlines/engine 0.43.30 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/worker.cjs +195 -95
- package/dist/_internal/worker.mjs +198 -98
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +11 -8
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +11 -8
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-B9AROf66.cjs → base-context-5_AZZYFu.cjs} +27 -32
- package/dist/{base-context-D8a2XGIK.mjs → base-context-D_ZidDDm.mjs} +29 -34
- package/dist/base-context-D_ZidDDm.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +67 -32
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +67 -32
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-DsA9XGVb.mjs → engine-context-PQ3BgcgR.mjs} +36 -11
- package/dist/engine-context-PQ3BgcgR.mjs.map +1 -0
- package/dist/{engine-context-qCVw66U_.cjs → engine-context-w4fts28j.cjs} +36 -10
- package/dist/{execution-context-CprxWvYn.cjs → execution-context-0GmpbWbs.cjs} +176 -71
- package/dist/{execution-context-CBJxP2B2.mjs → execution-context-zedP0h4Z.mjs} +179 -74
- package/dist/execution-context-zedP0h4Z.mjs.map +1 -0
- package/dist/index.cjs +140 -58
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +140 -58
- package/dist/index.mjs.map +1 -1
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.mts +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/typescript/index.d.mts +1 -1
- package/dist/{virtual-BNdKVkRw.cjs → virtual-1hYa9zCy.cjs} +1 -1
- package/dist/{virtual-gIlTc3Lj.mjs → virtual-CUgOdyIa.mjs} +2 -2
- package/dist/{virtual-gIlTc3Lj.mjs.map → virtual-CUgOdyIa.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/base-context-D8a2XGIK.mjs.map +0 -1
- package/dist/engine-context-DsA9XGVb.mjs.map +0 -1
- package/dist/execution-context-CBJxP2B2.mjs.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
2
|
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
3
|
-
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
4
3
|
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
5
4
|
let _powerlines_core_lib_config = require("@powerlines/core/lib/config");
|
|
6
5
|
let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
|
|
6
|
+
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
7
7
|
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
8
8
|
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
9
9
|
let _stryke_path_is_equal = require("@stryke/path/is-equal");
|
|
10
|
-
let
|
|
10
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
11
11
|
let chalk = require("chalk");
|
|
12
12
|
chalk = require_chunk.__toESM(chalk, 1);
|
|
13
13
|
let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
|
|
@@ -46,7 +46,6 @@ function createResolver(options) {
|
|
|
46
46
|
//#region src/context/base-context.ts
|
|
47
47
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
48
48
|
#timestamp = Date.now();
|
|
49
|
-
#logLevel = "info";
|
|
50
49
|
/**
|
|
51
50
|
* The path to the Powerlines package
|
|
52
51
|
*/
|
|
@@ -71,24 +70,16 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
71
70
|
* A timestamp representing when the context was initialized
|
|
72
71
|
*/
|
|
73
72
|
get timestamp() {
|
|
74
|
-
return
|
|
73
|
+
return this.#timestamp;
|
|
75
74
|
}
|
|
76
75
|
get logLevel() {
|
|
77
|
-
return this
|
|
78
|
-
}
|
|
79
|
-
set logLevel(level) {
|
|
80
|
-
this.#logLevel = level;
|
|
76
|
+
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(this.options.logLevel, this.options.mode);
|
|
81
77
|
}
|
|
82
78
|
/**
|
|
83
79
|
* The logger function
|
|
84
80
|
*/
|
|
85
81
|
get log() {
|
|
86
|
-
|
|
87
|
-
if (!this.logger || this.logger.level !== level) this.logger = {
|
|
88
|
-
log: this.createLog(),
|
|
89
|
-
level
|
|
90
|
-
};
|
|
91
|
-
return this.logger.log;
|
|
82
|
+
return this.createLog();
|
|
92
83
|
}
|
|
93
84
|
/**
|
|
94
85
|
* The environment paths for the project
|
|
@@ -119,7 +110,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
119
110
|
* @param message - The message to log.
|
|
120
111
|
*/
|
|
121
112
|
fatal(message) {
|
|
122
|
-
this.log(
|
|
113
|
+
this.log("error", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
123
114
|
}
|
|
124
115
|
/**
|
|
125
116
|
* A logging function for error messages
|
|
@@ -127,7 +118,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
127
118
|
* @param message - The message to log.
|
|
128
119
|
*/
|
|
129
120
|
error(message) {
|
|
130
|
-
this.log(
|
|
121
|
+
this.log("error", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
131
122
|
}
|
|
132
123
|
/**
|
|
133
124
|
* A logging function for warning messages
|
|
@@ -135,7 +126,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
135
126
|
* @param message - The message to log.
|
|
136
127
|
*/
|
|
137
128
|
warn(message) {
|
|
138
|
-
this.log(
|
|
129
|
+
this.log("warn", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
139
130
|
}
|
|
140
131
|
/**
|
|
141
132
|
* A logging function for informational messages
|
|
@@ -143,7 +134,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
143
134
|
* @param message - The message to log.
|
|
144
135
|
*/
|
|
145
136
|
info(message) {
|
|
146
|
-
this.log(
|
|
137
|
+
this.log("info", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
147
138
|
}
|
|
148
139
|
/**
|
|
149
140
|
* A logging function for debug messages
|
|
@@ -151,7 +142,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
151
142
|
* @param message - The message to log.
|
|
152
143
|
*/
|
|
153
144
|
debug(message) {
|
|
154
|
-
this.log(
|
|
145
|
+
this.log("debug", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
155
146
|
}
|
|
156
147
|
/**
|
|
157
148
|
* A logging function for trace messages
|
|
@@ -159,7 +150,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
159
150
|
* @param message - The message to log.
|
|
160
151
|
*/
|
|
161
152
|
trace(message) {
|
|
162
|
-
this.log(
|
|
153
|
+
this.log("trace", (0, _stryke_type_checks_is_string.isString)(message) ? message : _stryke_json_storm_json.StormJSON.stringify(message));
|
|
163
154
|
}
|
|
164
155
|
/**
|
|
165
156
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
@@ -179,29 +170,32 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
179
170
|
const startDuration = performance.now();
|
|
180
171
|
return () => {
|
|
181
172
|
const duration = performance.now() - startDuration;
|
|
182
|
-
this.log(
|
|
173
|
+
this.log({
|
|
174
|
+
level: "info",
|
|
175
|
+
category: "performance"
|
|
176
|
+
}, `${chalk.default.bold.cyanBright(name)} completed in ${chalk.default.bold.cyanBright(duration < 1e3 ? `${duration.toFixed(2)} milliseconds` : (0, date_fns_formatDistanceToNowStrict.formatDistanceToNowStrict)(startDate))}`);
|
|
183
177
|
};
|
|
184
178
|
}
|
|
185
179
|
/**
|
|
186
180
|
* Create a new logger instance
|
|
187
181
|
*
|
|
188
|
-
* @param
|
|
182
|
+
* @param config - 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.
|
|
189
183
|
* @returns A logger function
|
|
190
184
|
*/
|
|
191
|
-
createLog(
|
|
192
|
-
return (0, _powerlines_core_lib_logger.
|
|
185
|
+
createLog(config) {
|
|
186
|
+
return (0, _powerlines_core_lib_logger.createLogFn)({
|
|
193
187
|
...this.options,
|
|
194
|
-
|
|
188
|
+
...config
|
|
195
189
|
});
|
|
196
190
|
}
|
|
197
191
|
/**
|
|
198
|
-
* Extend the current logger instance with a new
|
|
192
|
+
* Extend the current logger instance with a new source
|
|
199
193
|
*
|
|
200
|
-
* @param
|
|
201
|
-
* @returns A logger function
|
|
194
|
+
* @param config - The overlay metadata to use for the badge in the log output, which can be used to customize the appearance and behavior of the log messages generated by the extended logger. This typically includes the name of the plugin or module that is creating the logger instance, and can also include other metadata such as the command or environment.
|
|
195
|
+
* @returns A new logger function that includes the badge in its output.
|
|
202
196
|
*/
|
|
203
|
-
extendLog(
|
|
204
|
-
return (0, _powerlines_core_lib_logger.
|
|
197
|
+
extendLog(config) {
|
|
198
|
+
return (0, _powerlines_core_lib_logger.extendLogFn)(this.log, config);
|
|
205
199
|
}
|
|
206
200
|
/**
|
|
207
201
|
* A logger function specific to this context
|
|
@@ -216,18 +210,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
216
210
|
* @param options - The configuration options to initialize the context with
|
|
217
211
|
*/
|
|
218
212
|
async init(options = {}) {
|
|
219
|
-
this.inputOptions = options;
|
|
213
|
+
this.inputOptions = { ...options };
|
|
220
214
|
if (!this.powerlinesPath) {
|
|
221
215
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
222
216
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
223
217
|
this.powerlinesPath = powerlinesPath;
|
|
224
218
|
}
|
|
225
219
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
226
|
-
const root = (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 : ".";
|
|
220
|
+
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);
|
|
227
221
|
this.options = (0, defu.default)({
|
|
228
222
|
root,
|
|
229
223
|
cwd,
|
|
230
224
|
mode: options.mode,
|
|
225
|
+
logLevel: options.logLevel,
|
|
231
226
|
framework: options.framework,
|
|
232
227
|
organization: options.organization,
|
|
233
228
|
configFile: options.configFile
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { resolvePackage } from "@stryke/fs/resolve";
|
|
2
|
-
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
2
|
import { isString } from "@stryke/type-checks/is-string";
|
|
4
3
|
import { loadUserConfigFile } from "@powerlines/core/lib/config";
|
|
5
|
-
import {
|
|
4
|
+
import { createLogFn, extendLogFn } from "@powerlines/core/lib/logger";
|
|
5
|
+
import { resolveLogLevel } from "@powerlines/core/plugin-utils";
|
|
6
6
|
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
7
7
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
8
8
|
import { isEqual } from "@stryke/path/is-equal";
|
|
9
|
-
import {
|
|
9
|
+
import { replacePath } from "@stryke/path/replace";
|
|
10
10
|
import chalk from "chalk";
|
|
11
11
|
import { formatDistanceToNowStrict } from "date-fns/formatDistanceToNowStrict";
|
|
12
12
|
import defu from "defu";
|
|
@@ -43,7 +43,6 @@ function createResolver(options) {
|
|
|
43
43
|
//#region src/context/base-context.ts
|
|
44
44
|
var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
45
45
|
#timestamp = Date.now();
|
|
46
|
-
#logLevel = "info";
|
|
47
46
|
/**
|
|
48
47
|
* The path to the Powerlines package
|
|
49
48
|
*/
|
|
@@ -68,24 +67,16 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
68
67
|
* A timestamp representing when the context was initialized
|
|
69
68
|
*/
|
|
70
69
|
get timestamp() {
|
|
71
|
-
return
|
|
70
|
+
return this.#timestamp;
|
|
72
71
|
}
|
|
73
72
|
get logLevel() {
|
|
74
|
-
return this
|
|
75
|
-
}
|
|
76
|
-
set logLevel(level) {
|
|
77
|
-
this.#logLevel = level;
|
|
73
|
+
return resolveLogLevel(this.options.logLevel, this.options.mode);
|
|
78
74
|
}
|
|
79
75
|
/**
|
|
80
76
|
* The logger function
|
|
81
77
|
*/
|
|
82
78
|
get log() {
|
|
83
|
-
|
|
84
|
-
if (!this.logger || this.logger.level !== level) this.logger = {
|
|
85
|
-
log: this.createLog(),
|
|
86
|
-
level
|
|
87
|
-
};
|
|
88
|
-
return this.logger.log;
|
|
79
|
+
return this.createLog();
|
|
89
80
|
}
|
|
90
81
|
/**
|
|
91
82
|
* The environment paths for the project
|
|
@@ -116,7 +107,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
116
107
|
* @param message - The message to log.
|
|
117
108
|
*/
|
|
118
109
|
fatal(message) {
|
|
119
|
-
this.log(
|
|
110
|
+
this.log("error", isString(message) ? message : StormJSON.stringify(message));
|
|
120
111
|
}
|
|
121
112
|
/**
|
|
122
113
|
* A logging function for error messages
|
|
@@ -124,7 +115,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
124
115
|
* @param message - The message to log.
|
|
125
116
|
*/
|
|
126
117
|
error(message) {
|
|
127
|
-
this.log(
|
|
118
|
+
this.log("error", isString(message) ? message : StormJSON.stringify(message));
|
|
128
119
|
}
|
|
129
120
|
/**
|
|
130
121
|
* A logging function for warning messages
|
|
@@ -132,7 +123,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
132
123
|
* @param message - The message to log.
|
|
133
124
|
*/
|
|
134
125
|
warn(message) {
|
|
135
|
-
this.log(
|
|
126
|
+
this.log("warn", isString(message) ? message : StormJSON.stringify(message));
|
|
136
127
|
}
|
|
137
128
|
/**
|
|
138
129
|
* A logging function for informational messages
|
|
@@ -140,7 +131,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
140
131
|
* @param message - The message to log.
|
|
141
132
|
*/
|
|
142
133
|
info(message) {
|
|
143
|
-
this.log(
|
|
134
|
+
this.log("info", isString(message) ? message : StormJSON.stringify(message));
|
|
144
135
|
}
|
|
145
136
|
/**
|
|
146
137
|
* A logging function for debug messages
|
|
@@ -148,7 +139,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
148
139
|
* @param message - The message to log.
|
|
149
140
|
*/
|
|
150
141
|
debug(message) {
|
|
151
|
-
this.log(
|
|
142
|
+
this.log("debug", isString(message) ? message : StormJSON.stringify(message));
|
|
152
143
|
}
|
|
153
144
|
/**
|
|
154
145
|
* A logging function for trace messages
|
|
@@ -156,7 +147,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
156
147
|
* @param message - The message to log.
|
|
157
148
|
*/
|
|
158
149
|
trace(message) {
|
|
159
|
-
this.log(
|
|
150
|
+
this.log("trace", isString(message) ? message : StormJSON.stringify(message));
|
|
160
151
|
}
|
|
161
152
|
/**
|
|
162
153
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
@@ -176,29 +167,32 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
176
167
|
const startDuration = performance.now();
|
|
177
168
|
return () => {
|
|
178
169
|
const duration = performance.now() - startDuration;
|
|
179
|
-
this.log(
|
|
170
|
+
this.log({
|
|
171
|
+
level: "info",
|
|
172
|
+
category: "performance"
|
|
173
|
+
}, `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(duration < 1e3 ? `${duration.toFixed(2)} milliseconds` : formatDistanceToNowStrict(startDate))}`);
|
|
180
174
|
};
|
|
181
175
|
}
|
|
182
176
|
/**
|
|
183
177
|
* Create a new logger instance
|
|
184
178
|
*
|
|
185
|
-
* @param
|
|
179
|
+
* @param config - 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.
|
|
186
180
|
* @returns A logger function
|
|
187
181
|
*/
|
|
188
|
-
createLog(
|
|
189
|
-
return
|
|
182
|
+
createLog(config) {
|
|
183
|
+
return createLogFn({
|
|
190
184
|
...this.options,
|
|
191
|
-
|
|
185
|
+
...config
|
|
192
186
|
});
|
|
193
187
|
}
|
|
194
188
|
/**
|
|
195
|
-
* Extend the current logger instance with a new
|
|
189
|
+
* Extend the current logger instance with a new source
|
|
196
190
|
*
|
|
197
|
-
* @param
|
|
198
|
-
* @returns A logger function
|
|
191
|
+
* @param config - The overlay metadata to use for the badge in the log output, which can be used to customize the appearance and behavior of the log messages generated by the extended logger. This typically includes the name of the plugin or module that is creating the logger instance, and can also include other metadata such as the command or environment.
|
|
192
|
+
* @returns A new logger function that includes the badge in its output.
|
|
199
193
|
*/
|
|
200
|
-
extendLog(
|
|
201
|
-
return
|
|
194
|
+
extendLog(config) {
|
|
195
|
+
return extendLogFn(this.log, config);
|
|
202
196
|
}
|
|
203
197
|
/**
|
|
204
198
|
* A logger function specific to this context
|
|
@@ -213,18 +207,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
213
207
|
* @param options - The configuration options to initialize the context with
|
|
214
208
|
*/
|
|
215
209
|
async init(options = {}) {
|
|
216
|
-
this.inputOptions = options;
|
|
210
|
+
this.inputOptions = { ...options };
|
|
217
211
|
if (!this.powerlinesPath) {
|
|
218
212
|
const powerlinesPath = await resolvePackage("powerlines");
|
|
219
213
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
220
214
|
this.powerlinesPath = powerlinesPath;
|
|
221
215
|
}
|
|
222
216
|
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
223
|
-
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !isEqual(options.root || this.options.root, cwd) ? options.root || this.options.root : ".";
|
|
217
|
+
const root = replacePath((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !isEqual(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
|
|
224
218
|
this.options = defu({
|
|
225
219
|
root,
|
|
226
220
|
cwd,
|
|
227
221
|
mode: options.mode,
|
|
222
|
+
logLevel: options.logLevel,
|
|
228
223
|
framework: options.framework,
|
|
229
224
|
organization: options.organization,
|
|
230
225
|
configFile: options.configFile
|
|
@@ -245,4 +240,4 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
245
240
|
|
|
246
241
|
//#endregion
|
|
247
242
|
export { PowerlinesBaseContext as t };
|
|
248
|
-
//# sourceMappingURL=base-context-
|
|
243
|
+
//# sourceMappingURL=base-context-D_ZidDDm.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-context-D_ZidDDm.mjs","names":["#timestamp"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Pick<ResolvedConfig, \"mode\" | \"logLevel\" | \"skipCache\"> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BaseContext,\n EngineOptions,\n LogFn,\n LogFnConfig,\n LogLevelResolvedConfig,\n ParsedUserConfig,\n PowerlinesMessage,\n ResolvedEngineOptions,\n Resolver\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { createLogFn, extendLogFn } from \"@powerlines/core/lib/logger\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { isEqual } from \"@stryke/path/is-equal\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process\n */\n public options!: ResolvedEngineOptions;\n\n /**\n * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context\n */\n public inputOptions: Partial<EngineOptions> = {};\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): number {\n return this.#timestamp;\n }\n\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.options.logLevel, this.options.mode);\n }\n\n /**\n * The logger function\n */\n public get log(): LogFn {\n return this.createLog();\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * 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.\n *\n * @remarks\n * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.\n *\n * @returns A promise that resolves to the cloned context.\n */\n public async clone(): Promise<BaseContext> {\n const clone = new PowerlinesBaseContext();\n await clone.init(this.options);\n\n return clone;\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | PowerlinesMessage) {\n this.log(\n \"error\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | PowerlinesMessage) {\n this.log(\n \"error\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | PowerlinesMessage) {\n this.log(\n \"warn\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | PowerlinesMessage) {\n this.log(\n \"info\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | PowerlinesMessage) {\n this.log(\n \"debug\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | PowerlinesMessage) {\n this.log(\n \"trace\",\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.log(\n { level: \"info\", category: \"performance\" },\n `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n );\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param config - 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.\n * @returns A logger function\n */\n public createLog(config?: LogFnConfig): LogFn {\n return createLogFn({ ...this.options, ...config });\n }\n\n /**\n * Extend the current logger instance with a new source\n *\n * @param config - The overlay metadata to use for the badge in the log output, which can be used to customize the appearance and behavior of the log messages generated by the extended logger. This typically includes the name of the plugin or module that is creating the logger instance, and can also include other metadata such as the command or environment.\n * @returns A new logger function that includes the badge in its output.\n */\n public extendLog(config: LogFnConfig): LogFn {\n return extendLogFn(this.log, config);\n }\n\n /**\n * A logger function specific to this context\n */\n protected logger!: Logger;\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n *\n * @param options - The configuration options to initialize the context with\n */\n protected async init(options: Partial<EngineOptions> = {}) {\n this.inputOptions = { ...options };\n\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n const cwd = options.cwd || this.options?.cwd || process.cwd();\n const root = replacePath(\n (options.root || this.options?.root) &&\n (options.root || this.options.root).replace(/^\\.\\/?/, \"\") &&\n !isEqual(options.root || this.options.root, cwd)\n ? options.root || this.options.root\n : \".\",\n cwd\n );\n\n this.options = defu(\n {\n root,\n cwd,\n mode: options.mode,\n logLevel: options.logLevel,\n framework: options.framework,\n organization: options.organization,\n configFile: options.configFile\n },\n this.options ?? {},\n {\n mode: \"production\",\n framework: \"powerlines\"\n }\n ) as ResolvedEngineOptions;\n\n this.resolver = createResolver({\n workspaceRoot: cwd,\n root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode,\n logLevel: this.logLevel\n });\n\n this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O,KAAK,SAAS,OAAO,QAAQ,KAAK;EAC7D,MAAM,OAAO,aACV,QAAQ,QAAQ,KAAK,SAAS,UAC5B,QAAQ,QAAQ,KAAK,QAAQ,MAAM,QAAQ,UAAU,GAAG,IACzD,CAAC,QAAQ,QAAQ,QAAQ,KAAK,QAAQ,MAAM,IAAI,GAC9C,QAAQ,QAAQ,KAAK,QAAQ,OAC7B,KACJ,IACD;AAED,OAAK,UAAU,KACb;GACE;GACA;GACA,MAAM,QAAQ;GACd,UAAU,QAAQ;GAClB,WAAW,QAAQ;GACnB,cAAc,QAAQ;GACtB,YAAY,QAAQ;GACrB,EACD,KAAK,WAAW,EAAE,EAClB;GACE,MAAM;GACN,WAAW;GACZ,CACF;AAED,OAAK,WAAW,eAAe;GAC7B,eAAe;GACf;GACA,UAAU,KAAK,SAAS;GACxB,MAAM,KAAK,QAAQ;GACnB,UAAU,KAAK;GAChB,CAAC;AAEF,OAAK,aAAa,MAAM,mBAAmB,KAAK,SAAS,KAAK,SAAS"}
|
package/dist/context/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_base_context = require('../base-context-
|
|
3
|
-
const require_engine_context = require('../engine-context-
|
|
4
|
-
const require_execution_context = require('../execution-context-
|
|
2
|
+
const require_base_context = require('../base-context-5_AZZYFu.cjs');
|
|
3
|
+
const require_engine_context = require('../engine-context-w4fts28j.cjs');
|
|
4
|
+
const require_execution_context = require('../execution-context-0GmpbWbs.cjs');
|
|
5
5
|
|
|
6
6
|
exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
|
|
7
7
|
exports.PowerlinesContext = require_execution_context.PowerlinesContext;
|
package/dist/context/index.d.cts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BaseContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EngineOptions, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, FetchOptions, HooksList, InlineConfig, LogFn,
|
|
1
|
+
import { BaseContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EngineOptions, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, ExecutionState, FetchOptions, HooksList, InlineConfig, LogFn, LogFnConfig, LogLevelResolvedConfig, MetaInfo, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, Plugin, PluginContext, PowerlinesMessage, ResolveOptions, ResolveResult, ResolvedConfig, ResolvedEngineOptions, ResolvedEntryTypeDefinition, ResolvedExecutionOptions, Resolver, SelectHookResult, SelectHooksOptions, TransformResult, VirtualFile, VirtualFileSystemInterface } from "@powerlines/core";
|
|
2
2
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
3
|
-
import { UnpluginMessage } from "unplugin";
|
|
4
3
|
import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
5
4
|
import { PackageJson } from "@stryke/types/package-json";
|
|
6
5
|
import { FlatCache } from "flat-cache";
|
|
@@ -34,9 +33,8 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
34
33
|
/**
|
|
35
34
|
* A timestamp representing when the context was initialized
|
|
36
35
|
*/
|
|
37
|
-
get timestamp():
|
|
38
|
-
get logLevel():
|
|
39
|
-
set logLevel(level: LogLevel | null);
|
|
36
|
+
get timestamp(): number;
|
|
37
|
+
get logLevel(): LogLevelResolvedConfig;
|
|
40
38
|
/**
|
|
41
39
|
* The logger function
|
|
42
40
|
*/
|
|
@@ -59,37 +57,37 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
59
57
|
*
|
|
60
58
|
* @param message - The message to log.
|
|
61
59
|
*/
|
|
62
|
-
fatal(message: string |
|
|
60
|
+
fatal(message: string | PowerlinesMessage): void;
|
|
63
61
|
/**
|
|
64
62
|
* A logging function for error messages
|
|
65
63
|
*
|
|
66
64
|
* @param message - The message to log.
|
|
67
65
|
*/
|
|
68
|
-
error(message: string |
|
|
66
|
+
error(message: string | PowerlinesMessage): void;
|
|
69
67
|
/**
|
|
70
68
|
* A logging function for warning messages
|
|
71
69
|
*
|
|
72
70
|
* @param message - The message to log.
|
|
73
71
|
*/
|
|
74
|
-
warn(message: string |
|
|
72
|
+
warn(message: string | PowerlinesMessage): void;
|
|
75
73
|
/**
|
|
76
74
|
* A logging function for informational messages
|
|
77
75
|
*
|
|
78
76
|
* @param message - The message to log.
|
|
79
77
|
*/
|
|
80
|
-
info(message: string |
|
|
78
|
+
info(message: string | PowerlinesMessage): void;
|
|
81
79
|
/**
|
|
82
80
|
* A logging function for debug messages
|
|
83
81
|
*
|
|
84
82
|
* @param message - The message to log.
|
|
85
83
|
*/
|
|
86
|
-
debug(message: string |
|
|
84
|
+
debug(message: string | PowerlinesMessage): void;
|
|
87
85
|
/**
|
|
88
86
|
* A logging function for trace messages
|
|
89
87
|
*
|
|
90
88
|
* @param message - The message to log.
|
|
91
89
|
*/
|
|
92
|
-
trace(message: string |
|
|
90
|
+
trace(message: string | PowerlinesMessage): void;
|
|
93
91
|
/**
|
|
94
92
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
95
93
|
*
|
|
@@ -107,17 +105,17 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
107
105
|
/**
|
|
108
106
|
* Create a new logger instance
|
|
109
107
|
*
|
|
110
|
-
* @param
|
|
108
|
+
* @param config - 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.
|
|
111
109
|
* @returns A logger function
|
|
112
110
|
*/
|
|
113
|
-
createLog(
|
|
111
|
+
createLog(config?: LogFnConfig): LogFn;
|
|
114
112
|
/**
|
|
115
|
-
* Extend the current logger instance with a new
|
|
113
|
+
* Extend the current logger instance with a new source
|
|
116
114
|
*
|
|
117
|
-
* @param
|
|
118
|
-
* @returns A logger function
|
|
115
|
+
* @param config - The overlay metadata to use for the badge in the log output, which can be used to customize the appearance and behavior of the log messages generated by the extended logger. This typically includes the name of the plugin or module that is creating the logger instance, and can also include other metadata such as the command or environment.
|
|
116
|
+
* @returns A new logger function that includes the badge in its output.
|
|
119
117
|
*/
|
|
120
|
-
extendLog(
|
|
118
|
+
extendLog(config: LogFnConfig): LogFn;
|
|
121
119
|
/**
|
|
122
120
|
* A logger function specific to this context
|
|
123
121
|
*/
|
|
@@ -282,6 +280,20 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
282
280
|
* @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
|
|
283
281
|
*/
|
|
284
282
|
protected constructor(options: ResolvedExecutionOptions);
|
|
283
|
+
/**
|
|
284
|
+
* 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.
|
|
285
|
+
*
|
|
286
|
+
* @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.
|
|
287
|
+
* @returns A log function that can be used to log messages with the specified configuration.
|
|
288
|
+
*/
|
|
289
|
+
createLog(config?: LogFnConfig): LogFn;
|
|
290
|
+
/**
|
|
291
|
+
* Extend the current log function instance with a new name
|
|
292
|
+
*
|
|
293
|
+
* @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.
|
|
294
|
+
* @returns A log function
|
|
295
|
+
*/
|
|
296
|
+
extendLog(config: LogFnConfig): LogFn;
|
|
285
297
|
/**
|
|
286
298
|
* 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.
|
|
287
299
|
*
|
|
@@ -291,13 +303,6 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
291
303
|
* @returns A promise that resolves to the cloned context.
|
|
292
304
|
*/
|
|
293
305
|
clone(): Promise<Context<TResolvedConfig>>;
|
|
294
|
-
/**
|
|
295
|
-
* Create a new logger instance
|
|
296
|
-
*
|
|
297
|
-
* @param name - The name to use for the logger instance
|
|
298
|
-
* @returns A logger function
|
|
299
|
-
*/
|
|
300
|
-
createLog(name?: string | null): LogFn;
|
|
301
306
|
/**
|
|
302
307
|
* A function to perform HTTP fetch requests
|
|
303
308
|
*
|
|
@@ -488,9 +493,9 @@ declare class PowerlinesEngineContext extends PowerlinesBaseContext implements E
|
|
|
488
493
|
/**
|
|
489
494
|
* A list of all command executions that will be run during the lifecycle of the engine
|
|
490
495
|
*
|
|
491
|
-
* @returns An array of
|
|
496
|
+
* @returns An array of {@link ExecutionState} representing each execution context for the engine.
|
|
492
497
|
*/
|
|
493
|
-
get executions():
|
|
498
|
+
get executions(): ExecutionState[];
|
|
494
499
|
}
|
|
495
500
|
//#endregion
|
|
496
501
|
//#region src/context/environment-context.d.ts
|
|
@@ -513,16 +518,27 @@ declare class PowerlinesEnvironmentContext<TResolvedConfig extends ResolvedConfi
|
|
|
513
518
|
*/
|
|
514
519
|
plugins: EnvironmentContextPlugin<TResolvedConfig>[];
|
|
515
520
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
* @param name - The name to use for the logger instance
|
|
519
|
-
* @returns A logger function
|
|
521
|
+
* The unique identifier of the environment associated with this context, which can be used for logging and other purposes to distinguish between different environments in the same process.
|
|
520
522
|
*/
|
|
521
|
-
|
|
523
|
+
get id(): string;
|
|
522
524
|
/**
|
|
523
525
|
* The hooks registered by plugins in this environment
|
|
524
526
|
*/
|
|
525
527
|
get hooks(): Record<string, HooksList<PluginContext<TResolvedConfig>>>;
|
|
528
|
+
/**
|
|
529
|
+
* 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.
|
|
530
|
+
*
|
|
531
|
+
* @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.
|
|
532
|
+
* @returns A log function that can be used to log messages with the specified configuration.
|
|
533
|
+
*/
|
|
534
|
+
createLog(config?: LogFnConfig): LogFn;
|
|
535
|
+
/**
|
|
536
|
+
* Extend the current log function instance with a new name
|
|
537
|
+
*
|
|
538
|
+
* @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.
|
|
539
|
+
* @returns A log function
|
|
540
|
+
*/
|
|
541
|
+
extendLog(config: LogFnConfig): LogFn;
|
|
526
542
|
/**
|
|
527
543
|
* 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.
|
|
528
544
|
*
|
|
@@ -588,6 +604,10 @@ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig
|
|
|
588
604
|
* @internal
|
|
589
605
|
*/
|
|
590
606
|
set $$internal(value: Unstable_ContextInternal<TResolvedConfig>);
|
|
607
|
+
/**
|
|
608
|
+
* The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
609
|
+
*/
|
|
610
|
+
get id(): string;
|
|
591
611
|
/**
|
|
592
612
|
* A record of all environments by name
|
|
593
613
|
*/
|
|
@@ -599,6 +619,20 @@ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig
|
|
|
599
619
|
* @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
|
|
600
620
|
*/
|
|
601
621
|
protected constructor(options: ResolvedExecutionOptions);
|
|
622
|
+
/**
|
|
623
|
+
* 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.
|
|
624
|
+
*
|
|
625
|
+
* @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.
|
|
626
|
+
* @returns A log function that can be used to log messages with the specified configuration.
|
|
627
|
+
*/
|
|
628
|
+
createLog(config?: LogFnConfig): LogFn;
|
|
629
|
+
/**
|
|
630
|
+
* Extend the current log function instance with a new name
|
|
631
|
+
*
|
|
632
|
+
* @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.
|
|
633
|
+
* @returns A log function
|
|
634
|
+
*/
|
|
635
|
+
extendLog(config: LogFnConfig): LogFn;
|
|
602
636
|
/**
|
|
603
637
|
* 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.
|
|
604
638
|
*
|
|
@@ -654,11 +688,12 @@ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig
|
|
|
654
688
|
/**
|
|
655
689
|
* Create a Proxy-based PluginContext
|
|
656
690
|
*
|
|
691
|
+
* @param pluginId - The unique identifier of the plugin
|
|
657
692
|
* @param plugin - The plugin instance
|
|
658
693
|
* @param environment - The environment context
|
|
659
694
|
* @returns The proxied plugin context
|
|
660
695
|
*/
|
|
661
|
-
declare function createPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(plugin: Plugin<PluginContext<TResolvedConfig>>, environment: Unstable_EnvironmentContext<TResolvedConfig>): Unstable_PluginContext<TResolvedConfig>;
|
|
696
|
+
declare function createPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(pluginId: string, plugin: Plugin<PluginContext<TResolvedConfig>>, environment: Unstable_EnvironmentContext<TResolvedConfig>): Unstable_PluginContext<TResolvedConfig>;
|
|
662
697
|
//#endregion
|
|
663
698
|
export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
|
|
664
699
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/base-context.ts","../../src/context/context.ts","../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/execution-context.ts","../../src/context/plugin-context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/base-context.ts","../../src/context/context.ts","../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/execution-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;;;;;cA2Ca,qBAAA,YAAiC,WAAA;EAAA;;;;EAMrC,cAAA;;;AANT;EAWS,QAAA,EAAW,QAAA;;;;EAKX,OAAA,EAAU,qBAAA;EAKI;;;EAAd,YAAA,EAAc,OAAA,CAAQ,aAAA;EA4BN;;;EAvBhB,UAAA,EAAa,gBAAA;EA+DW;;;EAAA,IA1DpB,SAAA,CAAA;EAAA,IAIA,QAAA,CAAA,GAAY,sBAAA;EAiJG;;;EAAA,IA1If,GAAA,CAAA,GAAO,KAAA;EA2JC;;;EAAA,IApJR,QAAA,CAAA,GAAY,QAAA;EAjDqB;;;;;;;;EAiE/B,KAAA,CAAA,GAAS,OAAA,CAAQ,WAAA;EAjDb;;;;;EA6DV,KAAA,CAAM,OAAA,WAAkB,iBAAA;EA9CpB;;;;;EA0DJ,KAAA,CAAM,OAAA,WAAkB,iBAAA;EAxCR;;;;;EAoDhB,IAAA,CAAK,OAAA,WAAkB,iBAAA;EAxBjB;;;;;EAoCN,IAAA,CAAK,OAAA,WAAkB,iBAAA;EAZlB;;;;;EAwBL,KAAA,CAAM,OAAA,WAAkB,iBAAA;EAAlB;;;;;EAYN,KAAA,CAAM,OAAA,WAAkB,iBAAA;EA2CxB;;;;;;;;;;;;;EAvBA,KAAA,CAAM,IAAA;EAkD4C;;;;;;EA3BlD,SAAA,CAAU,MAAA,GAAS,WAAA,GAAc,KAAA;ECrFZ;;;;;;ED+FrB,SAAA,CAAU,MAAA,EAAQ,WAAA,GAAc,KAAA;ECzD5B;;;EAAA,UDgED,MAAA,EAAS,MAAA;EChDM;;;;;;;;EAAA,UD0DT,IAAA,CAAK,OAAA,GAAS,OAA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