@powerlines/engine 0.43.27 → 0.43.28
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 +18 -11
- package/dist/_internal/worker.mjs +18 -11
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{base-context-CFvO2N9I.cjs → base-context-BgAxrobW.cjs} +8 -10
- package/dist/{base-context-BUnL_9z8.mjs → base-context-D9PKchy4.mjs} +9 -11
- package/dist/base-context-D9PKchy4.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-NO6enYev.cjs → engine-context-B5zOInDj.cjs} +1 -1
- package/dist/{engine-context-BuD9AGfd.mjs → engine-context-B7_Cc9N2.mjs} +2 -2
- package/dist/{engine-context-BuD9AGfd.mjs.map → engine-context-B7_Cc9N2.mjs.map} +1 -1
- package/dist/{execution-context-DyQewevZ.mjs → execution-context-BmRT3Anb.mjs} +12 -3
- package/dist/{execution-context-DyQewevZ.mjs.map → execution-context-BmRT3Anb.mjs.map} +1 -1
- package/dist/{execution-context-DiR9f4Pj.cjs → execution-context-R45_zd18.cjs} +11 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/base-context-BUnL_9z8.mjs.map +0 -1
package/dist/api.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
-
const require_execution_context = require('./execution-context-
|
|
3
|
+
const require_execution_context = require('./execution-context-R45_zd18.cjs');
|
|
4
4
|
const require_tsconfig = require('./tsconfig-DeyWQC2N.cjs');
|
|
5
5
|
const require_ts_morph = require('./ts-morph-BaLPVAdB.cjs');
|
|
6
6
|
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
package/dist/api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-
|
|
1
|
+
import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-BmRT3Anb.mjs";
|
|
2
2
|
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-Cstsoprg.mjs";
|
|
3
3
|
import { n as createProgram } from "./ts-morph-D0CaA37w.mjs";
|
|
4
4
|
import { resolvePackage } from "@stryke/fs/resolve";
|
|
@@ -92,7 +92,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
92
92
|
return (0, _stryke_env_get_env_paths.getEnvPaths)({
|
|
93
93
|
orgId: this.options.organization,
|
|
94
94
|
appId: this.options.framework || "powerlines",
|
|
95
|
-
workspaceRoot: this.options.cwd
|
|
95
|
+
workspaceRoot: this.options.cwd
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -216,21 +216,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
216
216
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
217
217
|
this.powerlinesPath = powerlinesPath;
|
|
218
218
|
}
|
|
219
|
+
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
220
|
+
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root) !== cwd ? options.root || this.options.root : "./";
|
|
219
221
|
this.options = (0, defu.default)({
|
|
220
|
-
root
|
|
221
|
-
cwd
|
|
222
|
+
root,
|
|
223
|
+
cwd,
|
|
222
224
|
mode: options.mode,
|
|
223
225
|
framework: options.framework,
|
|
224
226
|
organization: options.organization,
|
|
225
227
|
configFile: options.configFile
|
|
226
|
-
}, this.options ?? {}
|
|
227
|
-
cwd: process.cwd() || ".",
|
|
228
|
-
mode: "production",
|
|
229
|
-
framework: "powerlines"
|
|
230
|
-
});
|
|
228
|
+
}, this.options ?? {});
|
|
231
229
|
this.resolver = createResolver({
|
|
232
|
-
workspaceRoot:
|
|
233
|
-
root
|
|
230
|
+
workspaceRoot: cwd,
|
|
231
|
+
root,
|
|
234
232
|
cacheDir: this.envPaths.cache,
|
|
235
233
|
mode: this.options.mode,
|
|
236
234
|
logLevel: this.logLevel
|
|
@@ -89,7 +89,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
89
89
|
return getEnvPaths({
|
|
90
90
|
orgId: this.options.organization,
|
|
91
91
|
appId: this.options.framework || "powerlines",
|
|
92
|
-
workspaceRoot: this.options.cwd
|
|
92
|
+
workspaceRoot: this.options.cwd
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
@@ -213,21 +213,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
213
213
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
214
214
|
this.powerlinesPath = powerlinesPath;
|
|
215
215
|
}
|
|
216
|
+
const cwd = options.cwd || this.options?.cwd || process.cwd();
|
|
217
|
+
const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root) !== cwd ? options.root || this.options.root : "./";
|
|
216
218
|
this.options = defu({
|
|
217
|
-
root
|
|
218
|
-
cwd
|
|
219
|
+
root,
|
|
220
|
+
cwd,
|
|
219
221
|
mode: options.mode,
|
|
220
222
|
framework: options.framework,
|
|
221
223
|
organization: options.organization,
|
|
222
224
|
configFile: options.configFile
|
|
223
|
-
}, this.options ?? {}
|
|
224
|
-
cwd: process.cwd() || ".",
|
|
225
|
-
mode: "production",
|
|
226
|
-
framework: "powerlines"
|
|
227
|
-
});
|
|
225
|
+
}, this.options ?? {});
|
|
228
226
|
this.resolver = createResolver({
|
|
229
|
-
workspaceRoot:
|
|
230
|
-
root
|
|
227
|
+
workspaceRoot: cwd,
|
|
228
|
+
root,
|
|
231
229
|
cacheDir: this.envPaths.cache,
|
|
232
230
|
mode: this.options.mode,
|
|
233
231
|
logLevel: this.logLevel
|
|
@@ -238,4 +236,4 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
|
|
|
238
236
|
|
|
239
237
|
//#endregion
|
|
240
238
|
export { PowerlinesBaseContext as t };
|
|
241
|
-
//# sourceMappingURL=base-context-
|
|
239
|
+
//# sourceMappingURL=base-context-D9PKchy4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-context-D9PKchy4.mjs","names":["#timestamp","#logLevel"],"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 Logger,\n LogLevel,\n ParsedUserConfig,\n ResolvedEngineOptions,\n Resolver\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { createLog, extendLog } from \"@powerlines/core/lib/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { UnpluginMessage } from \"unplugin\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n #logLevel: LogLevel | null = \"info\";\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 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(): Date {\n return new Date(this.#timestamp);\n }\n\n public get logLevel(): LogLevel | null {\n return this.#logLevel || \"info\";\n }\n\n public set logLevel(level: LogLevel | null) {\n this.#logLevel = level;\n }\n\n /**\n * The logger function\n */\n public get log(): LogFn {\n const level = this.logLevel || \"info\";\n if (!this.logger || this.logger.level !== level) {\n this.logger = {\n log: this.createLog(),\n level\n };\n }\n\n return this.logger.log;\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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.FATAL,\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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.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 | UnpluginMessage) {\n this.log(\n LogLevelLabel.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 LogLevelLabel.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 name - The name to use for the logger instance\n * @returns A logger function\n */\n public createLog(name: string | null = null): LogFn {\n return createLog(name, {\n ...this.options,\n logLevel: isNull(this.logLevel) ? \"silent\" : this.logLevel\n });\n }\n\n /**\n * Extend the current logger instance with a new name\n *\n * @param name - The name to use for the extended logger instance\n * @returns A logger function\n */\n public extendLog(name: string): LogFn {\n return extendLog(this.log, name);\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 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 =\n (options.root || this.options?.root) &&\n (options.root || this.options.root).replace(/^\\.\\/?/, \"\") &&\n (options.root || this.options.root) !== cwd\n ? options.root || this.options.root\n : \"./\";\n\n this.options = defu(\n {\n root,\n cwd,\n mode: options.mode,\n framework: options.framework,\n organization: options.organization,\n configFile: options.configFile\n },\n this.options ?? {}\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.configFile = await loadUserConfigFile(this.options, this.resolver);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACb,UAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpB,UAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACxBT,IAAa,wBAAb,MAAa,sBAA6C;CACxD,aAAqB,KAAK,KAAK;CAE/B,YAA6B;;;;CAK7B,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAKP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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-BgAxrobW.cjs');
|
|
3
|
+
const require_engine_context = require('../engine-context-B5zOInDj.cjs');
|
|
4
|
+
const require_execution_context = require('../execution-context-R45_zd18.cjs');
|
|
5
5
|
|
|
6
6
|
exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
|
|
7
7
|
exports.PowerlinesContext = require_execution_context.PowerlinesContext;
|
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-D9PKchy4.mjs";
|
|
2
|
+
import { t as PowerlinesEngineContext } from "../engine-context-B7_Cc9N2.mjs";
|
|
3
|
+
import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-BmRT3Anb.mjs";
|
|
4
4
|
|
|
5
5
|
export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_base_context = require('./base-context-
|
|
1
|
+
const require_base_context = require('./base-context-BgAxrobW.cjs');
|
|
2
2
|
|
|
3
3
|
//#region src/context/engine-context.ts
|
|
4
4
|
var PowerlinesEngineContext = class PowerlinesEngineContext extends require_base_context.PowerlinesBaseContext {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-D9PKchy4.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/context/engine-context.ts
|
|
4
4
|
var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBaseContext {
|
|
@@ -38,4 +38,4 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
|
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
40
|
export { PowerlinesEngineContext as t };
|
|
41
|
-
//# sourceMappingURL=engine-context-
|
|
41
|
+
//# sourceMappingURL=engine-context-B7_Cc9N2.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context-
|
|
1
|
+
{"version":3,"file":"engine-context-B7_Cc9N2.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 ResolvedExecutionOptions\n} from \"@powerlines/core\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ResolvedExecutionOptions[] = [];\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 (_, configIndex) => ({\n ...context.options,\n configIndex\n }))\n );\n } else {\n context.#executions = [\n {\n ...context.options,\n configIndex: 0\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 ResolvedExecutionOptions representing each execution context for the engine.\n */\n public get executions(): ResolvedExecutionOptions[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;AAyBA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAA0C,EAAE;;;;;;;CAQ5C,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,iBAAiB;GACvD,GAAG,QAAQ;GACX;GACD,EAAE,CACJ;MAED,UAAQA,aAAc,CACpB;GACE,GAAG,QAAQ;GACX,aAAa;GACd,CACF;AAGH,SAAO;;;;;;;CAQT,IAAW,aAAyC;AAClD,SAAO,MAAKA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-D9PKchy4.mjs";
|
|
2
2
|
import { a as FileSystem } from "./fs-D1nIP45P.mjs";
|
|
3
3
|
import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-gIlTc3Lj.mjs";
|
|
4
4
|
import { i as getTsconfigFilePath } from "./tsconfig-Cstsoprg.mjs";
|
|
@@ -1960,6 +1960,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1960
1960
|
* Initialize the context with the provided configuration options
|
|
1961
1961
|
*/
|
|
1962
1962
|
async innerSetup() {
|
|
1963
|
+
if (!this.options.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
1964
|
+
this.options.mode = "production";
|
|
1965
|
+
this.config.mode = "production";
|
|
1966
|
+
}
|
|
1967
|
+
if (!this.options.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
1968
|
+
this.options.framework = "powerlines";
|
|
1969
|
+
this.config.framework = "powerlines";
|
|
1970
|
+
}
|
|
1963
1971
|
this.resolvedConfig.compatibilityDate = resolveCompatibilityDates(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
1964
1972
|
this.logger = {
|
|
1965
1973
|
log: this.createLog(this.config.name),
|
|
@@ -2001,7 +2009,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2001
2009
|
if (this.config.output.path) this.config.output.path = appendPath(replacePathTokens(this, this.config.output.path), this.config.cwd);
|
|
2002
2010
|
if (this.config.output.copy !== false) {
|
|
2003
2011
|
this.config.output.copy ??= {};
|
|
2004
|
-
this.config.output.copy.path = appendPath(replacePathTokens(this, this.config.output.copy.path
|
|
2012
|
+
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? appendPath(replacePathTokens(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
2013
|
+
else this.config.output.copy.path = appendPath(replacePathTokens(this, this.config.output.copy.path || joinPaths("dist", this.config.root)), this.config.cwd);
|
|
2005
2014
|
}
|
|
2006
2015
|
if (this.config.output.dts !== false && this.config.output.types !== false) this.config.output.types = appendPath(replacePathTokens(this, this.config.output.types || joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
2007
2016
|
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 = getUniqueBy(this.config.output.copy.assets.map((asset) => {
|
|
@@ -2559,4 +2568,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2559
2568
|
|
|
2560
2569
|
//#endregion
|
|
2561
2570
|
export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
|
|
2562
|
-
//# sourceMappingURL=execution-context-
|
|
2571
|
+
//# sourceMappingURL=execution-context-BmRT3Anb.mjs.map
|