@powerlines/engine 0.44.8 → 0.44.10
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-D-XTNs1z.cjs → execution-context-CsQO4NOI.cjs} +87 -42
- package/dist/{execution-context-BLq0jnIo.mjs → execution-context-DlQIqoRZ.mjs} +89 -44
- package/dist/execution-context-DlQIqoRZ.mjs.map +1 -0
- package/dist/index.cjs +6 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +6 -5
- 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-BLq0jnIo.mjs.map +0 -1
package/dist/context/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
|
2
2
|
import { FlatCache } from "flat-cache";
|
|
3
3
|
import { ParseResult } from "oxc-parser";
|
|
4
4
|
import { RequestInfo, Response } from "undici";
|
|
5
|
-
import { BaseContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EngineOptions, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, ExecutionState, FetchOptions, HooksList, InlineConfig, LogLevelResolvedConfig, LogMessage, Logger,
|
|
5
|
+
import { BaseContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EngineOptions, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, ExecutionState, FetchOptions, HooksList, InlineConfig, LogFn, LogLevelResolvedConfig, LogMessage, Logger, LoggerOptions, MetaInfo, Mode, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, Plugin, PluginContext, ResolveOptions, ResolveResult, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHooksOptions, TransformResult, VirtualFile, VirtualFileSystemInterface, WorkspaceConfig } from "@powerlines/core";
|
|
6
6
|
import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
7
7
|
import { PackageJson } from "@stryke/types/package-json";
|
|
8
8
|
import { Range } from "semver";
|
|
@@ -21,7 +21,7 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
21
21
|
/**
|
|
22
22
|
* The options provided to the Powerlines process
|
|
23
23
|
*/
|
|
24
|
-
options:
|
|
24
|
+
options: EngineOptions;
|
|
25
25
|
/**
|
|
26
26
|
* 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
|
|
27
27
|
*/
|
|
@@ -106,9 +106,10 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
106
106
|
* Create a new logger instance
|
|
107
107
|
*
|
|
108
108
|
* @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.
|
|
109
|
+
* @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.
|
|
109
110
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
110
111
|
*/
|
|
111
|
-
createLogger(options: LoggerOptions,
|
|
112
|
+
createLogger(options: LoggerOptions, logFn?: LogFn): Logger;
|
|
112
113
|
/**
|
|
113
114
|
* Extend the base logger with additional configuration options
|
|
114
115
|
*
|
|
@@ -116,6 +117,24 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
116
117
|
* @returns A new logger client instance that extends the base logger with the provided configuration options.
|
|
117
118
|
*/
|
|
118
119
|
extendLogger(options: LoggerOptions): Logger;
|
|
120
|
+
/**
|
|
121
|
+
* 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.
|
|
122
|
+
*
|
|
123
|
+
* @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.
|
|
124
|
+
*/
|
|
125
|
+
protected getWorkspaceConfig(): Promise<WorkspaceConfig | undefined>;
|
|
126
|
+
/**
|
|
127
|
+
* 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".
|
|
128
|
+
*
|
|
129
|
+
* @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
|
|
130
|
+
*/
|
|
131
|
+
protected getDefaultMode(): Promise<Mode>;
|
|
132
|
+
/**
|
|
133
|
+
* 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.
|
|
134
|
+
*
|
|
135
|
+
* @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
|
|
136
|
+
*/
|
|
137
|
+
protected getDefaultLogLevel(): Promise<LogLevelResolvedConfig>;
|
|
119
138
|
/**
|
|
120
139
|
* Initialize the context with the provided configuration options
|
|
121
140
|
*
|
|
@@ -124,7 +143,7 @@ declare class PowerlinesBaseContext implements BaseContext {
|
|
|
124
143
|
*
|
|
125
144
|
* @param options - The configuration options to initialize the context with
|
|
126
145
|
*/
|
|
127
|
-
protected init(options
|
|
146
|
+
protected init(options: EngineOptions): Promise<void>;
|
|
128
147
|
}
|
|
129
148
|
//#endregion
|
|
130
149
|
//#region src/context/context.d.ts
|
|
@@ -136,11 +155,11 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
136
155
|
* @param options - The options for resolving the context.
|
|
137
156
|
* @returns A promise that resolves to the new context.
|
|
138
157
|
*/
|
|
139
|
-
static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options:
|
|
158
|
+
static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions): Promise<Context<TResolvedConfig>>;
|
|
140
159
|
/**
|
|
141
160
|
* The options provided to the Powerlines process
|
|
142
161
|
*/
|
|
143
|
-
options:
|
|
162
|
+
options: ExecutionOptions;
|
|
144
163
|
/**
|
|
145
164
|
* An object containing the dependencies that should be installed for the project
|
|
146
165
|
*/
|
|
@@ -259,9 +278,21 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
259
278
|
*/
|
|
260
279
|
get alias(): Record<string, string>;
|
|
261
280
|
/**
|
|
262
|
-
*
|
|
281
|
+
* Create a new logger instance
|
|
282
|
+
*
|
|
283
|
+
* @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.
|
|
284
|
+
* @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.
|
|
285
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
263
286
|
*/
|
|
264
|
-
|
|
287
|
+
createLogger(options: LoggerOptions, logFn?: LogFn): Logger;
|
|
288
|
+
/**
|
|
289
|
+
* 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.
|
|
290
|
+
*/
|
|
291
|
+
get logLevel(): LogLevelResolvedConfig;
|
|
292
|
+
/**
|
|
293
|
+
* 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.
|
|
294
|
+
*/
|
|
295
|
+
get envPaths(): EnvPaths;
|
|
265
296
|
/**
|
|
266
297
|
* Gets the parser cache.
|
|
267
298
|
*/
|
|
@@ -279,7 +310,7 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
279
310
|
*
|
|
280
311
|
* @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
|
|
281
312
|
*/
|
|
282
|
-
protected constructor(options:
|
|
313
|
+
protected constructor(options: ExecutionOptions);
|
|
283
314
|
/**
|
|
284
315
|
* 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.
|
|
285
316
|
*
|
|
@@ -459,7 +490,7 @@ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = Resolve
|
|
|
459
490
|
*
|
|
460
491
|
* @param options - The configuration options to initialize the context with
|
|
461
492
|
*/
|
|
462
|
-
protected init(options
|
|
493
|
+
protected init(options: ExecutionOptions): Promise<void>;
|
|
463
494
|
/**
|
|
464
495
|
* Initialize the context with the provided configuration options
|
|
465
496
|
*/
|
|
@@ -494,7 +525,7 @@ declare class PowerlinesEnvironmentContext<TResolvedConfig extends ResolvedConfi
|
|
|
494
525
|
* @param config - The user configuration options.
|
|
495
526
|
* @returns A promise that resolves to the new context.
|
|
496
527
|
*/
|
|
497
|
-
static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options:
|
|
528
|
+
static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, config: TResolvedConfig, environment: EnvironmentResolvedConfig): Promise<PowerlinesEnvironmentContext<TResolvedConfig>>;
|
|
498
529
|
/**
|
|
499
530
|
* The resolved environment configuration
|
|
500
531
|
*/
|
|
@@ -515,9 +546,10 @@ declare class PowerlinesEnvironmentContext<TResolvedConfig extends ResolvedConfi
|
|
|
515
546
|
* Create a new logger instance
|
|
516
547
|
*
|
|
517
548
|
* @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.
|
|
549
|
+
* @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.
|
|
518
550
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
519
551
|
*/
|
|
520
|
-
createLogger(options: LoggerOptions,
|
|
552
|
+
createLogger(options: LoggerOptions, logFn?: LogFn): Logger;
|
|
521
553
|
/**
|
|
522
554
|
* Extend the base logger with additional configuration options
|
|
523
555
|
*
|
|
@@ -543,7 +575,7 @@ declare class PowerlinesEnvironmentContext<TResolvedConfig extends ResolvedConfi
|
|
|
543
575
|
* Retrieves the hook handlers for a specific hook name
|
|
544
576
|
*/
|
|
545
577
|
selectHooks<TKey extends string>(key: TKey, options?: SelectHooksOptions): SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
|
|
546
|
-
protected constructor(options:
|
|
578
|
+
protected constructor(options: ExecutionOptions, config: TResolvedConfig, environment: EnvironmentResolvedConfig);
|
|
547
579
|
/**
|
|
548
580
|
* 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.
|
|
549
581
|
*
|
|
@@ -564,14 +596,14 @@ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig
|
|
|
564
596
|
* @param options - The options for resolving the context.
|
|
565
597
|
* @returns A promise that resolves to the new context.
|
|
566
598
|
*/
|
|
567
|
-
static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options:
|
|
599
|
+
static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions): Promise<ExecutionContext<TResolvedConfig>>;
|
|
568
600
|
/**
|
|
569
601
|
* Create a new Storm context from the workspace root and user config.
|
|
570
602
|
*
|
|
571
603
|
* @param options - The options for resolving the context.
|
|
572
604
|
* @returns A promise that resolves to the new context.
|
|
573
605
|
*/
|
|
574
|
-
static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options:
|
|
606
|
+
static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, config: InlineConfig): Promise<ExecutionContext<TResolvedConfig>>;
|
|
575
607
|
/**
|
|
576
608
|
* Internal context fields and methods
|
|
577
609
|
*
|
|
@@ -604,14 +636,15 @@ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig
|
|
|
604
636
|
*
|
|
605
637
|
* @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
|
|
606
638
|
*/
|
|
607
|
-
protected constructor(options:
|
|
639
|
+
protected constructor(options: ExecutionOptions);
|
|
608
640
|
/**
|
|
609
641
|
* Create a new logger instance
|
|
610
642
|
*
|
|
611
643
|
* @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.
|
|
644
|
+
* @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.
|
|
612
645
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
613
646
|
*/
|
|
614
|
-
createLogger(options: LoggerOptions,
|
|
647
|
+
createLogger(options: LoggerOptions, logFn?: LogFn): Logger;
|
|
615
648
|
/**
|
|
616
649
|
* Extend the base logger with additional configuration options
|
|
617
650
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","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.mts","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":";;;;;;;;;;cA2Da,qBAAA,YAAiC,WAAA;EAAA;;;;EAMrC,cAAA;;;AANT;EAWS,QAAA,EAAW,QAAA;;;;EAKX,OAAA,EAAU,aAAA;EAKI;;;EAAd,YAAA,EAAc,OAAA,CAAQ,aAAA;EA4BN;;;EAvBhB,UAAA,EAAa,gBAAA;EA4DW;;;EAAA,IAvDpB,MAAA,CAAA,GAAU,MAAA;EA2FU;;;EAAA,IApFpB,SAAA,CAAA;EAAA,IAIA,QAAA,CAAA,GAAY,sBAAA;EAyIsB;;;EAAA,IAlIlC,QAAA,CAAA,GAAY,QAAA;EAkKW;;;;;;;;EAlJrB,KAAA,CAAA,GAAS,OAAA,CAAQ,WAAA;;;;;;EAYvB,KAAA,CAAM,OAAA,WAAkB,UAAA;EAxDxB;;;;;EAiEA,KAAA,CAAM,OAAA,WAAkB,UAAA;EAvDV;;;;;EAgEd,IAAA,CAAK,OAAA,WAAkB,UAAA;EA9BjB;;;;;EAuCN,IAAA,CAAK,OAAA,WAAkB,UAAA;EAlBvB;;;;;EA2BA,KAAA,CAAM,OAAA,WAAkB,UAAA;EATxB;;;;;EAkBA,KAAA,CAAM,OAAA,WAAkB,UAAA;EAAxB;;;;;;;;;;;;;EAiBA,KAAA,CAAM,IAAA;EAwCgC;;;;;;;EAdtC,YAAA,CAAa,OAAA,EAAS,aAAA,EAAe,KAAA,GAAQ,KAAA,GAAQ,MAAA;EA+DtB;;;;;;EAjD/B,YAAA,CA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AA,CAAO,aAAA,CAAc,eAAA,KAAiB,OAAA;EJlExC;;;;;;EIkFhB,cAAA,CAAe,IAAA,YAAa,OAAA,CAAA,kBAAA,CAAA,eAAA;EJlDP;;;;;;EIyFrB,kBAAA,CACX,IAAA,YACC,OAAA,CAAQ,kBAAA,CAAmB,eAAA;EJ7CT;;;;;;;ACzKvB;EGsOe,aAAA,CAAA,GAAiB,OAAA,CAAQ,kBAAA,CAAmB,eAAA;AAAA;;;;;;;;;;;iBC5U3C,mBAAA,yBACU,cAAA,GAAiB,cAAA,CAAA,CAEzC,QAAA,UACA,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,IAC7B,WAAA,EAAa,2BAAA,CAA4B,eAAA,IACxC,sBAAA,CAAuB,eAAA"}
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "../base-context-
|
|
2
|
-
import { t as PowerlinesEngineContext } from "../engine-context-
|
|
3
|
-
import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "../base-context-C6yzgs6K.mjs";
|
|
2
|
+
import { t as PowerlinesEngineContext } from "../engine-context-C-11i43N.mjs";
|
|
3
|
+
import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-DlQIqoRZ.mjs";
|
|
4
4
|
|
|
5
5
|
export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-C6yzgs6K.mjs";
|
|
2
2
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
3
3
|
|
|
4
4
|
//#region src/context/engine-context.ts
|
|
@@ -63,4 +63,4 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
|
|
|
63
63
|
|
|
64
64
|
//#endregion
|
|
65
65
|
export { PowerlinesEngineContext as t };
|
|
66
|
-
//# sourceMappingURL=engine-context-
|
|
66
|
+
//# sourceMappingURL=engine-context-C-11i43N.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context-
|
|
1
|
+
{"version":3,"file":"engine-context-C-11i43N.mjs","names":["#executions"],"sources":["../src/context/engine-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 {\n EngineContext,\n EngineOptions,\n ExecutionState\n} from \"@powerlines/core\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ExecutionState[] = [];\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async fromOptions(\n options: EngineOptions\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext();\n await context.init(options);\n\n if (!context.configFile?.config) {\n context.fatal(\n \"No configuration file found. Please ensure you have a valid configuration file in your project.\"\n );\n throw new Error(\"No configuration file found\");\n }\n\n if (Array.isArray(context.configFile.config)) {\n context.#executions = await Promise.all(\n context.configFile.config.map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n ...context.options,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n } else {\n const executionId = uuid();\n context.#executions = [\n {\n executionId,\n options: {\n ...context.options,\n executionId,\n executionIndex: 0\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n }\n ];\n }\n\n return context;\n }\n\n /**\n * A list of all command executions that will be run during the lifecycle of the engine\n *\n * @returns An array of {@link ExecutionState} representing each execution context for the engine.\n */\n public get executions(): ExecutionState[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;;AA0BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,YAClB,SACkC;EAClC,MAAM,UAAU,IAAI,yBAAyB;AAC7C,QAAM,QAAQ,KAAK,QAAQ;AAE3B,MAAI,CAAC,QAAQ,YAAY,QAAQ;AAC/B,WAAQ,MACN,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,MAAI,MAAM,QAAQ,QAAQ,WAAW,OAAO,CAC1C,UAAQA,aAAc,MAAM,QAAQ,IAClC,QAAQ,WAAW,OAAO,IAAI,OAAO,GAAG,mBAAmB;GACzD,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,GAAG,QAAQ;KACX;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;OACI;GACL,MAAM,cAAc,MAAM;AAC1B,YAAQA,aAAc,CACpB;IACE;IACA,SAAS;KACP,GAAG,QAAQ;KACX;KACA,gBAAgB;KACjB;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF,CACF;;AAGH,SAAO;;;;;;;CAQT,IAAW,aAA+B;AACxC,SAAO,MAAKA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
const require_base_context = require('./base-context-
|
|
2
|
+
const require_base_context = require('./base-context-trNQZNsX.cjs');
|
|
3
3
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
4
4
|
|
|
5
5
|
//#region src/context/engine-context.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
const require_base_context = require('./base-context-
|
|
2
|
+
const require_base_context = require('./base-context-trNQZNsX.cjs');
|
|
3
3
|
const require_fs = require('./fs-XogSgMqT.cjs');
|
|
4
4
|
const require_virtual = require('./virtual-Ct3ZqPeN.cjs');
|
|
5
5
|
const require_tsconfig = require('./tsconfig-QMSxSwBD.cjs');
|
|
@@ -14,6 +14,7 @@ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-stri
|
|
|
14
14
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
15
15
|
let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
|
|
16
16
|
let _powerlines_core_plugin_utils_logging = require("@powerlines/core/plugin-utils/logging");
|
|
17
|
+
let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
|
|
17
18
|
let _stryke_path_append = require("@stryke/path/append");
|
|
18
19
|
let _stryke_path_is_equal = require("@stryke/path/is-equal");
|
|
19
20
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
@@ -34,6 +35,7 @@ let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
|
34
35
|
let _stryke_fs_json = require("@stryke/fs/json");
|
|
35
36
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
36
37
|
let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
|
|
38
|
+
let _stryke_convert_to_bool = require("@stryke/convert/to-bool");
|
|
37
39
|
let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
|
|
38
40
|
let _stryke_hash = require("@stryke/hash");
|
|
39
41
|
let _stryke_hash_node = require("@stryke/hash/node");
|
|
@@ -145,34 +147,34 @@ async function writeMetaFile(context) {
|
|
|
145
147
|
|
|
146
148
|
//#endregion
|
|
147
149
|
//#region src/_internal/ipc/send.ts
|
|
148
|
-
function sendWriteLogMessage(context,
|
|
149
|
-
const
|
|
150
|
-
...
|
|
151
|
-
...
|
|
150
|
+
function sendWriteLogMessage(context, meta, message) {
|
|
151
|
+
const combinedMeta = {
|
|
152
|
+
...context.logger.options,
|
|
153
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(meta) ? meta : { type: meta }
|
|
152
154
|
};
|
|
153
155
|
process.send?.({
|
|
154
156
|
id: (0, _stryke_unique_id_uuid.uuid)(),
|
|
155
157
|
type: "write-log",
|
|
156
|
-
executionId:
|
|
157
|
-
executionIndex:
|
|
158
|
-
environment:
|
|
158
|
+
executionId: combinedMeta.executionId || context.config.executionId,
|
|
159
|
+
executionIndex: combinedMeta.executionIndex ?? context.config.executionIndex,
|
|
160
|
+
environment: combinedMeta.environment,
|
|
159
161
|
timestamp: Date.now(),
|
|
160
162
|
payload: {
|
|
161
163
|
meta: {
|
|
162
|
-
type,
|
|
163
|
-
category:
|
|
164
|
-
logId:
|
|
165
|
-
timestamp:
|
|
166
|
-
name:
|
|
167
|
-
executionId:
|
|
168
|
-
executionIndex:
|
|
169
|
-
command:
|
|
170
|
-
hook:
|
|
171
|
-
environment:
|
|
172
|
-
plugin:
|
|
173
|
-
source:
|
|
164
|
+
type: combinedMeta.type,
|
|
165
|
+
category: combinedMeta.category || _powerlines_core.LogCategories.GENERAL,
|
|
166
|
+
logId: combinedMeta.logId || (0, _stryke_unique_id_uuid.uuid)(),
|
|
167
|
+
timestamp: combinedMeta.timestamp ?? Date.now(),
|
|
168
|
+
name: combinedMeta.name || context.config.name,
|
|
169
|
+
executionId: combinedMeta.executionId || context.config.executionId,
|
|
170
|
+
executionIndex: combinedMeta.executionIndex ?? context.config.executionIndex,
|
|
171
|
+
command: combinedMeta.command || context.config.command,
|
|
172
|
+
hook: combinedMeta.hook,
|
|
173
|
+
environment: combinedMeta.environment,
|
|
174
|
+
plugin: combinedMeta.plugin,
|
|
175
|
+
source: combinedMeta.source
|
|
174
176
|
},
|
|
175
|
-
message
|
|
177
|
+
message
|
|
176
178
|
}
|
|
177
179
|
});
|
|
178
180
|
}
|
|
@@ -1508,18 +1510,45 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1508
1510
|
}, {}) : this.config.resolve.alias : {});
|
|
1509
1511
|
}
|
|
1510
1512
|
/**
|
|
1511
|
-
*
|
|
1513
|
+
* Create a new logger instance
|
|
1514
|
+
*
|
|
1515
|
+
* @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.
|
|
1516
|
+
* @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.
|
|
1517
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
1512
1518
|
*/
|
|
1513
|
-
|
|
1514
|
-
|
|
1519
|
+
createLogger(options, logFn) {
|
|
1520
|
+
let logger;
|
|
1521
|
+
if ((0, _stryke_convert_to_bool.toBool)(process.env.POWERLINES_WORKER_THREAD_EXECUTION)) logger = (0, _powerlines_core_plugin_utils.createLogger)(this.config.name, {
|
|
1522
|
+
...this.options,
|
|
1515
1523
|
...this.config,
|
|
1516
|
-
...
|
|
1517
|
-
};
|
|
1518
|
-
|
|
1519
|
-
|
|
1524
|
+
...options
|
|
1525
|
+
}, (meta, message) => sendWriteLogMessage(this, meta, message));
|
|
1526
|
+
else logger = (0, _powerlines_core_plugin_utils.createLogger)(this.config.name, {
|
|
1527
|
+
...this.options,
|
|
1528
|
+
...this.config,
|
|
1529
|
+
...options
|
|
1530
|
+
});
|
|
1531
|
+
if (this.config.customLogger) logger = (0, _powerlines_core_plugin_utils.withCustomLogger)(logger, this.config.customLogger);
|
|
1532
|
+
if (logFn) logger = (0, _powerlines_core_plugin_utils.withLogFn)(logger, logFn);
|
|
1520
1533
|
return logger;
|
|
1521
1534
|
}
|
|
1522
1535
|
/**
|
|
1536
|
+
* 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.
|
|
1537
|
+
*/
|
|
1538
|
+
get logLevel() {
|
|
1539
|
+
return (0, _powerlines_core_plugin_utils.resolveLogLevel)(this.config.logLevel, this.config.mode);
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* 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.
|
|
1543
|
+
*/
|
|
1544
|
+
get envPaths() {
|
|
1545
|
+
return (0, _stryke_env_get_env_paths.getEnvPaths)({
|
|
1546
|
+
orgId: this.config.organization,
|
|
1547
|
+
appId: this.config.framework || "powerlines",
|
|
1548
|
+
workspaceRoot: this.config.cwd
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1523
1552
|
* Gets the parser cache.
|
|
1524
1553
|
*/
|
|
1525
1554
|
get parserCache() {
|
|
@@ -1932,18 +1961,16 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1932
1961
|
*/
|
|
1933
1962
|
async setup() {
|
|
1934
1963
|
this.resolvedConfig = (0, _powerlines_core_plugin_utils.mergeConfig)({
|
|
1964
|
+
root: this.options.root,
|
|
1965
|
+
cwd: this.options.cwd,
|
|
1935
1966
|
inlineConfig: this.config.inlineConfig ?? {},
|
|
1936
1967
|
userConfig: this.config.userConfig ?? {},
|
|
1937
1968
|
pluginConfig: this.config.pluginConfig ?? {}
|
|
1938
|
-
},
|
|
1969
|
+
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
1939
1970
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
1940
1971
|
version: this.packageJson?.version,
|
|
1941
1972
|
description: this.packageJson?.description
|
|
1942
1973
|
}, {
|
|
1943
|
-
projectType: "application",
|
|
1944
|
-
platform: "neutral",
|
|
1945
|
-
logLevel: "info",
|
|
1946
|
-
preview: false,
|
|
1947
1974
|
environments: {},
|
|
1948
1975
|
resolve: {}
|
|
1949
1976
|
});
|
|
@@ -1985,7 +2012,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1985
2012
|
*
|
|
1986
2013
|
* @param options - The configuration options to initialize the context with
|
|
1987
2014
|
*/
|
|
1988
|
-
async init(options
|
|
2015
|
+
async init(options) {
|
|
1989
2016
|
await super.init(options);
|
|
1990
2017
|
this.options.executionId = options.executionId ?? this.options.executionId;
|
|
1991
2018
|
this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
|
|
@@ -2021,7 +2048,6 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2021
2048
|
glob: "package.json"
|
|
2022
2049
|
}
|
|
2023
2050
|
] },
|
|
2024
|
-
artifactsPath: `.${this.config.framework ?? "powerlines"}`,
|
|
2025
2051
|
dts: true
|
|
2026
2052
|
});
|
|
2027
2053
|
logger.trace(`Pre-setup Powerlines configuration object: \n${JSON.stringify({
|
|
@@ -2038,6 +2064,8 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2038
2064
|
this.options.framework = "powerlines";
|
|
2039
2065
|
this.config.framework = "powerlines";
|
|
2040
2066
|
}
|
|
2067
|
+
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2068
|
+
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2041
2069
|
this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2042
2070
|
this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
|
|
2043
2071
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
@@ -2077,6 +2105,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2077
2105
|
else this.config.output.sourceMap = false;
|
|
2078
2106
|
if (!this.config.userConfig?.output?.minify && !this.config.inlineConfig?.output?.minify) if (this.config.mode === "production") this.config.output.minify = true;
|
|
2079
2107
|
else this.config.output.minify = false;
|
|
2108
|
+
if (!this.config.userConfig?.output?.artifactsPath && !this.config.inlineConfig?.output?.artifactsPath && !this.config.pluginConfig?.output?.artifactsPath) this.config.output.artifactsPath = `.${this.config.framework || "powerlines"}`;
|
|
2080
2109
|
if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
|
|
2081
2110
|
...asset,
|
|
2082
2111
|
glob: (0, _powerlines_core_plugin_utils.replacePathTokens)(this, asset.glob),
|
|
@@ -2238,10 +2267,17 @@ function extractHooks(context, hooks, plugin, key, parentKey) {
|
|
|
2238
2267
|
* @returns The proxied plugin context
|
|
2239
2268
|
*/
|
|
2240
2269
|
function createPluginContext(pluginId, plugin, environment) {
|
|
2270
|
+
const logger = environment.extendLogger({ plugin: plugin.name });
|
|
2241
2271
|
const normalizeMessage = (message) => {
|
|
2242
|
-
return
|
|
2272
|
+
return {
|
|
2273
|
+
meta: {
|
|
2274
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(message) ? message.meta : {},
|
|
2275
|
+
environment: environment.environment?.name,
|
|
2276
|
+
plugin: plugin.name
|
|
2277
|
+
},
|
|
2278
|
+
message: (0, _stryke_type_checks_is_string.isString)(message) ? message : message.message
|
|
2279
|
+
};
|
|
2243
2280
|
};
|
|
2244
|
-
const logger = environment.extendLogger({ plugin: plugin.name.replaceAll(":", " - ") });
|
|
2245
2281
|
const callHookFn = async (hook, options, ...args) => {
|
|
2246
2282
|
return environment.$$internal.api.callHook(hook, {
|
|
2247
2283
|
sequential: true,
|
|
@@ -2261,6 +2297,9 @@ function createPluginContext(pluginId, plugin, environment) {
|
|
|
2261
2297
|
};
|
|
2262
2298
|
if (prop === "id") return pluginId;
|
|
2263
2299
|
if (prop === "logger") return logger;
|
|
2300
|
+
if (prop === "log") return (type, message) => {
|
|
2301
|
+
logger.log(type, normalizeMessage(message));
|
|
2302
|
+
};
|
|
2264
2303
|
if (prop === "fatal") return (message) => {
|
|
2265
2304
|
logger.error(normalizeMessage(message));
|
|
2266
2305
|
};
|
|
@@ -2351,13 +2390,14 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
2351
2390
|
* Create a new logger instance
|
|
2352
2391
|
*
|
|
2353
2392
|
* @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.
|
|
2393
|
+
* @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.
|
|
2354
2394
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2355
2395
|
*/
|
|
2356
|
-
createLogger(options,
|
|
2396
|
+
createLogger(options, logFn) {
|
|
2357
2397
|
return super.createLogger({
|
|
2358
2398
|
...options,
|
|
2359
2399
|
environment: this.environment?.name
|
|
2360
|
-
},
|
|
2400
|
+
}, logFn);
|
|
2361
2401
|
}
|
|
2362
2402
|
/**
|
|
2363
2403
|
* Extend the base logger with additional configuration options
|
|
@@ -2390,7 +2430,11 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
2390
2430
|
this.resolvedConfig = (0, _powerlines_core_plugin_utils.mergeConfig)({
|
|
2391
2431
|
name: this.config.name,
|
|
2392
2432
|
title: this.config.title
|
|
2393
|
-
}, getConfigProps(
|
|
2433
|
+
}, getConfigProps({
|
|
2434
|
+
...this.environment,
|
|
2435
|
+
root: this.options.root,
|
|
2436
|
+
cwd: this.options.cwd
|
|
2437
|
+
}), this.config);
|
|
2394
2438
|
await this.innerSetup();
|
|
2395
2439
|
}
|
|
2396
2440
|
async addPlugin(plugin) {
|
|
@@ -2556,14 +2600,15 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2556
2600
|
* Create a new logger instance
|
|
2557
2601
|
*
|
|
2558
2602
|
* @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.
|
|
2603
|
+
* @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.
|
|
2559
2604
|
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
2560
2605
|
*/
|
|
2561
|
-
createLogger(options,
|
|
2606
|
+
createLogger(options, logFn) {
|
|
2562
2607
|
return super.createLogger({
|
|
2563
2608
|
...options,
|
|
2564
2609
|
executionId: this.id,
|
|
2565
2610
|
executionIndex: this.options.executionIndex
|
|
2566
|
-
},
|
|
2611
|
+
}, logFn);
|
|
2567
2612
|
}
|
|
2568
2613
|
/**
|
|
2569
2614
|
* Extend the base logger with additional configuration options
|