@powerlines/engine 0.46.4 → 0.46.6
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 +34 -54
- package/dist/_internal/worker.mjs +35 -55
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +2 -15
- package/dist/api.d.cts +1 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +3 -16
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-D7G_24-i.cjs → base-context-CbFlRUd-.cjs} +8 -6
- package/dist/{base-context-DU0NRHDt.mjs → base-context-Ce9PuQ9z.mjs} +9 -7
- package/dist/{base-context-DU0NRHDt.mjs.map → base-context-Ce9PuQ9z.mjs.map} +1 -1
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +1 -1
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-BvDfqfY7.mjs → engine-context-CEbC9dHR.mjs} +2 -2
- package/dist/{engine-context-BvDfqfY7.mjs.map → engine-context-CEbC9dHR.mjs.map} +1 -1
- package/dist/{engine-context-BuJQY312.cjs → engine-context-D-rpz-J2.cjs} +1 -1
- package/dist/{execution-context-Dxa103Qg.cjs → execution-context-9aXwcpL6.cjs} +26 -34
- package/dist/{execution-context-Bb5pfsyN.mjs → execution-context-DUtt6PWE.mjs} +32 -40
- package/dist/execution-context-DUtt6PWE.mjs.map +1 -0
- package/dist/{execution-context-CghMd-eP.d.cts → execution-context-Da_wozne.d.mts} +5 -6
- package/dist/execution-context-Da_wozne.d.mts.map +1 -0
- package/dist/{execution-context-rKd-zSZy.d.mts → execution-context-NyDjVZ6T.d.cts} +5 -6
- package/dist/execution-context-NyDjVZ6T.d.cts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -3
- package/dist/execution-context-Bb5pfsyN.mjs.map +0 -1
- package/dist/execution-context-CghMd-eP.d.cts.map +0 -1
- package/dist/execution-context-rKd-zSZy.d.mts.map +0 -1
|
@@ -283,12 +283,14 @@ var PowerlinesBaseContext = class {
|
|
|
283
283
|
* @returns A promise that resolves when the package configurations have been loaded and stored in the context.
|
|
284
284
|
*/
|
|
285
285
|
async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
286
|
+
if (cwd || root) {
|
|
287
|
+
const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "project.json");
|
|
288
|
+
if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
|
|
289
|
+
const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "package.json");
|
|
290
|
+
if ((0, node_fs.existsSync)(packageJsonPath)) {
|
|
291
|
+
this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
|
|
292
|
+
this.options.organization ??= (0, _stryke_type_checks_is_set_object.isSetObject)(this.packageJson?.author) ? (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author?.name) : (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author);
|
|
293
|
+
}
|
|
292
294
|
}
|
|
293
295
|
}
|
|
294
296
|
/**
|
|
@@ -280,12 +280,14 @@ var PowerlinesBaseContext = class {
|
|
|
280
280
|
* @returns A promise that resolves when the package configurations have been loaded and stored in the context.
|
|
281
281
|
*/
|
|
282
282
|
async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
283
|
+
if (cwd || root) {
|
|
284
|
+
const projectJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "project.json");
|
|
285
|
+
if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
|
|
286
|
+
const packageJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "package.json");
|
|
287
|
+
if (existsSync(packageJsonPath)) {
|
|
288
|
+
this.packageJson = await readJsonFile(packageJsonPath);
|
|
289
|
+
this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
|
|
290
|
+
}
|
|
289
291
|
}
|
|
290
292
|
}
|
|
291
293
|
/**
|
|
@@ -310,4 +312,4 @@ var PowerlinesBaseContext = class {
|
|
|
310
312
|
|
|
311
313
|
//#endregion
|
|
312
314
|
export { PowerlinesBaseContext as t };
|
|
313
|
-
//# sourceMappingURL=base-context-
|
|
315
|
+
//# sourceMappingURL=base-context-Ce9PuQ9z.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-context-DU0NRHDt.mjs","names":["joinPaths","#timestamp","createLogger"],"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 Partial<Pick<ResolvedConfig, \"mode\" | \"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 LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\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, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\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 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 * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\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.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${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 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.\n * @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.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\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 protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method 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 as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * 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.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\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 protected async init() {\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 this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n await this.resolvePackageConfigs();\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n const projectJsonPath = joinPaths(appendPath(root, cwd), \"project.json\");\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(appendPath(root, cwd), \"package.json\");\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n }\n\n /**\n * 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\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * 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.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACbA,YAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACx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AM,aAAa,gBAAgB;EAGxD,MAAM,kBAAkB,UAAU,WAAW,MAAM,IAAI,EAAE,eAAe;AACxE,MAAI,WAAW,gBAAgB,EAAE;AAC/B,QAAK,cAAc,MAAM,aAA0B,gBAAgB;AACnE,QAAK,QAAQ,iBAAiB,YAAY,KAAK,aAAa,OAAO,GAC/D,UAAU,KAAK,aAAa,QAAQ,KAAK,GACzC,UAAU,KAAK,aAAa,OAAO;;;;;;;;CAS3C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
|
|
1
|
+
{"version":3,"file":"base-context-Ce9PuQ9z.mjs","names":["joinPaths","#timestamp","createLogger"],"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 Partial<Pick<ResolvedConfig, \"mode\" | \"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 LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\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, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\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 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 * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\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.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${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 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.\n * @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.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\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 protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method 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 as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * 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.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\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 protected async init() {\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 this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n await this.resolvePackageConfigs();\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n }\n }\n\n /**\n * 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\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * 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.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACbA,YAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE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ACd,MAAc,KAAK,QAAQ,KAC3B,OAAe,KAAK,QAAQ,MAC5B;AACA,MAAI,OAAO,MAAM;GACf,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,IAAI,EACnC,eACD;AACD,OAAI,WAAW,gBAAgB,CAC7B,MAAK,cAAc,MAAM,aAAa,gBAAgB;GAGxD,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,IAAI,EACnC,eACD;AACD,OAAI,WAAW,gBAAgB,EAAE;AAC/B,SAAK,cAAc,MAAM,aAA0B,gBAAgB;AACnE,SAAK,QAAQ,iBAAiB,YAAY,KAAK,aAAa,OAAO,GAC/D,UAAU,KAAK,aAAa,QAAQ,KAAK,GACzC,UAAU,KAAK,aAAa,OAAO;;;;;;;;;CAU7C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
|
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-CbFlRUd-.cjs');
|
|
3
|
+
const require_engine_context = require('../engine-context-D-rpz-J2.cjs');
|
|
4
|
+
const require_execution_context = require('../execution-context-9aXwcpL6.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,4 +1,4 @@
|
|
|
1
|
-
import { n as PowerlinesContext, r as PowerlinesBaseContext, t as PowerlinesExecutionContext } from "../execution-context-
|
|
1
|
+
import { n as PowerlinesContext, r as PowerlinesBaseContext, t as PowerlinesExecutionContext } from "../execution-context-NyDjVZ6T.cjs";
|
|
2
2
|
import { EngineContext, EngineOptions, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionOptions, ExecutionState, HooksList, InferOverridableConfig, LogFn, LogLevelResolvedConfig, Logger, LoggerOptions, Plugin, PluginContext, ResolvedConfig, SelectHookResult, SelectHooksOptions, UserConfig } from "@powerlines/core";
|
|
3
3
|
import { DeepPartial, RequiredKeys } from "@stryke/types/base";
|
|
4
4
|
import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,uBAAA,SACH,qBAAA,YACG,aAAA;EAAA;;AAFb;;;;;SAYsB,iBAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA,IAC1B,OAAA,CAAQ,uBAAA;EAAA;;;EAAA,SAUc,cAAA,EAAgB,aAAA;EAKD;;;EAAA,SAAf,aAAA,EAAe,WAAA,CAAY,UAAA;EAYxC;;;EAPI,OAAA,EAAS,YAAA,CACvB,IAAA,CAAK,aAAA;IAsCsB;;;IAhC3B,QAAA,EAAU,sBAAA;EAAA;EAxCY;;;;;;EAAA,UAyDf,WAAA,CACP,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA;EA/CZ;;;;;;EAAA,UA4DQ,IAAA,CAAA,GAAI,OAAA;EA5CJ;;;;;EAAA,IAmFd,UAAA,CAAA,GAAc,cAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,uBAAA,SACH,qBAAA,YACG,aAAA;EAAA;;AAFb;;;;;SAYsB,iBAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA,IAC1B,OAAA,CAAQ,uBAAA;EAAA;;;EAAA,SAUc,cAAA,EAAgB,aAAA;EAKD;;;EAAA,SAAf,aAAA,EAAe,WAAA,CAAY,UAAA;EAYxC;;;EAPI,OAAA,EAAS,YAAA,CACvB,IAAA,CAAK,aAAA;IAsCsB;;;IAhC3B,QAAA,EAAU,sBAAA;EAAA;EAxCY;;;;;;EAAA,UAyDf,WAAA,CACP,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA;EA/CZ;;;;;;EAAA,UA4DQ,IAAA,CAAA,GAAI,OAAA;EA5CJ;;;;;EAAA,IAmFd,UAAA,CAAA,GAAc,cAAA;AAAA;;;cClFd,4BAAA,yBACa,cAAA,GAAiB,cAAA,UAEjC,iBAAA,CAAkB,yBAAA,CAA0B,eAAA,cACzC,2BAAA,CAA4B,eAAA;EAAA;;ADnCzC;;;;;;;;SC6DsB,iBAAA,yBACM,cAAA,GAAiB,cAAA,CAAA,CAEzC,cAAA,EAAgB,gBAAA,EAChB,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA,IAE5B,WAAA,EAAa,yBAAA,CAA0B,eAAA,mBACtC,OAAA,CAAQ,4BAAA,CAA6B,eAAA;EDxCY;;;EAAA,UCsDjC,iBAAA,EAAmB,yBAAA,CAA0B,eAAA;EDjDvC;;;ECuD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Context } from "../execution-context-
|
|
1
|
+
import { n as PowerlinesContext, r as PowerlinesBaseContext, t as PowerlinesExecutionContext } from "../execution-context-Da_wozne.mjs";
|
|
2
2
|
import { EngineContext, EngineOptions, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionOptions, ExecutionState, HooksList, InferOverridableConfig, LogFn, LogLevelResolvedConfig, Logger, LoggerOptions, Plugin, PluginContext, ResolvedConfig, SelectHookResult, SelectHooksOptions, UserConfig } from "@powerlines/core";
|
|
3
3
|
import { DeepPartial, RequiredKeys } from "@stryke/types/base";
|
|
4
4
|
import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,uBAAA,SACH,qBAAA,YACG,aAAA;EAAA;;AAFb;;;;;SAYsB,iBAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA,IAC1B,OAAA,CAAQ,uBAAA;EAAA;;;EAAA,SAUc,cAAA,EAAgB,aAAA;EAKD;;;EAAA,SAAf,aAAA,EAAe,WAAA,CAAY,UAAA;EAYxC;;;EAPI,OAAA,EAAS,YAAA,CACvB,IAAA,CAAK,aAAA;IAsCsB;;;IAhC3B,QAAA,EAAU,sBAAA;EAAA;EAxCY;;;;;;EAAA,UAyDf,WAAA,CACP,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,WAAA,CAAY,UAAA;EA/CZ;;;;;;EAAA,UA4DQ,IAAA,CAAA,GAAI,OAAA;EA5CJ;;;;;EAAA,IAmFd,UAAA,CAAA,GAAc,cAAA;AAAA;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;cA8Ba,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AA,SAElB,SAAA,CAAU,aAAA,CAAc,eAAA;ED5FnB;;;;;;EAAA,UCuGS,oBAAA,CACd,MAAA,EAAQ,yBAAA,CAA0B,eAAA,mBACjC,OAAA;EDhF0B;;;;;;;ECiGb,YAAA,CAAa,OAAA,EAAS,aAAA,EAAe,KAAA,GAAQ,KAAA,GAAQ,MAAA;;;;AA/HvE;;;EA+IkB,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAOzC,SAAA,CACX,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,KAC5B,OAAA;EArJiD;;;EAsN7C,WAAA,qBAAA,CACL,GAAA,EAAK,IAAA,EACL,OAAA,GAAU,kBAAA,GACT,gBAAA,CAAiB,aAAA,CAAc,eAAA,GAAkB,IAAA;EAAA,UAqD3C,WAAA,CACP,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA;EApPZ;;;;;EAAA,UAsQC,WAAA,CAAA,GAAe,yBAAA,CAA0B,eAAA;AAAA;;;;;;ADtU9D;;;;;iBEagB,mBAAA,yBACU,cAAA,GAAiB,cAAA,CAAA,CAEzC,QAAA,UACA,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,IAC7B,WAAA,EAAa,4BAAA,CAA6B,eAAA,IACzC,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-Ce9PuQ9z.mjs";
|
|
2
|
+
import { t as PowerlinesEngineContext } from "../engine-context-CEbC9dHR.mjs";
|
|
3
|
+
import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-DUtt6PWE.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-Ce9PuQ9z.mjs";
|
|
2
2
|
import { toArray } from "@stryke/convert/to-array";
|
|
3
3
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
4
4
|
|
|
@@ -83,4 +83,4 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
|
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
85
|
export { PowerlinesEngineContext as t };
|
|
86
|
-
//# sourceMappingURL=engine-context-
|
|
86
|
+
//# sourceMappingURL=engine-context-CEbC9dHR.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine-context-
|
|
1
|
+
{"version":3,"file":"engine-context-CEbC9dHR.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 LogLevelResolvedConfig,\n UserConfig\n} from \"@powerlines/core\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\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 fromInitialConfig(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext(options, initialConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialOptions: EngineOptions;\n\n /**\n * The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n public override readonly initialConfig: DeepPartial<UserConfig>;\n\n /**\n * The options provided to the Powerlines process\n */\n public override options: RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n } = {} as RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n };\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n super(options, initialConfig);\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\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 protected override async init() {\n await super.init();\n\n if (!this.configFile?.config) {\n this.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 this.#executions = await Promise.all(\n toArray(this.configFile.config).map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n cwd: this.options.cwd,\n root: this.options.root,\n configFile: this.options.configFile,\n ...this.initialOptions,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\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":";;;;;AA8BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,kBAClB,SACA,gBAAyC,EAAE,EACT;EAClC,MAAM,UAAU,IAAI,wBAAwB,SAAS,cAAc;AACnE,QAAM,QAAQ,MAAM;AAEpB,SAAO;;;;;CAMT,AAAyB;;;;CAKzB,AAAyB;;;;CAKzB,AAAgB,UAQZ,EAAE;;;;;;;CAgBN,AAAU,YACR,SACA,gBAAyC,EAAE,EAC3C;AACA,QAAM,SAAS,cAAc;AAC7B,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;;;;;;;;CASvB,MAAyB,OAAO;AAC9B,QAAM,MAAM,MAAM;AAElB,MAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,QAAK,MACH,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,QAAKA,aAAc,MAAM,QAAQ,IAC/B,QAAQ,KAAK,WAAW,OAAO,CAAC,IAAI,OAAO,GAAG,mBAAmB;GAC/D,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,KAAK,KAAK,QAAQ;KAClB,MAAM,KAAK,QAAQ;KACnB,YAAY,KAAK,QAAQ;KACzB,GAAG,KAAK;KACR;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;;;;;;;CAQH,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-CbFlRUd-.cjs');
|
|
3
3
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
4
4
|
let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
|
|
5
5
|
|
|
@@ -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-CbFlRUd-.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-BUDqmOaT.cjs');
|
|
@@ -23,6 +23,7 @@ let chalk = require("chalk");
|
|
|
23
23
|
chalk = require_chunk.__toESM(chalk, 1);
|
|
24
24
|
let defu = require("defu");
|
|
25
25
|
defu = require_chunk.__toESM(defu, 1);
|
|
26
|
+
let node_fs = require("node:fs");
|
|
26
27
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
27
28
|
let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
|
|
28
29
|
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
@@ -41,6 +42,7 @@ let _stryke_hash = require("@stryke/hash");
|
|
|
41
42
|
let _stryke_hash_node = require("@stryke/hash/node");
|
|
42
43
|
let _stryke_http_fetch = require("@stryke/http/fetch");
|
|
43
44
|
let _stryke_path_is_equal = require("@stryke/path/is-equal");
|
|
45
|
+
let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
|
|
44
46
|
let bundle_require = require("bundle-require");
|
|
45
47
|
let compatx = require("compatx");
|
|
46
48
|
let flat_cache = require("flat-cache");
|
|
@@ -1944,7 +1946,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1944
1946
|
async setInlineConfig(config) {
|
|
1945
1947
|
this.logger.debug({
|
|
1946
1948
|
meta: { category: "config" },
|
|
1947
|
-
message: `Updating inline configuration object: \n${
|
|
1949
|
+
message: `Updating inline configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
|
|
1948
1950
|
});
|
|
1949
1951
|
this.inlineConfig = config;
|
|
1950
1952
|
await this.resolveConfig();
|
|
@@ -1958,7 +1960,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1958
1960
|
async setPluginConfig(config) {
|
|
1959
1961
|
this.logger.debug({
|
|
1960
1962
|
meta: { category: "config" },
|
|
1961
|
-
message: `Updating plugin configuration object: \n${
|
|
1963
|
+
message: `Updating plugin configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
|
|
1962
1964
|
});
|
|
1963
1965
|
this.pluginConfig = config;
|
|
1964
1966
|
await this.resolveConfig();
|
|
@@ -2000,7 +2002,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2000
2002
|
async setUserConfig(config) {
|
|
2001
2003
|
this.logger.debug({
|
|
2002
2004
|
meta: { category: "config" },
|
|
2003
|
-
message: `Updating user configuration object: \n${
|
|
2005
|
+
message: `Updating user configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
|
|
2004
2006
|
});
|
|
2005
2007
|
this.userConfig = config;
|
|
2006
2008
|
await this.resolveConfig();
|
|
@@ -2037,7 +2039,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2037
2039
|
const mergedConfig = this.mergeConfig();
|
|
2038
2040
|
this.logger.trace({
|
|
2039
2041
|
meta: { category: "config" },
|
|
2040
|
-
message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n
|
|
2042
|
+
message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(mergedConfig)} \n\n --- Initial Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.initialOptions)} \n\n --- Initial Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.initialConfig)} \n\n --- User Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.userConfig)} \n\n --- Inline Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.inlineConfig)} \n\n --- Plugin Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.pluginConfig)} \n\n --- Environment Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.environmentConfig)} \n\n --- Overridden Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.overriddenConfig)}`
|
|
2041
2043
|
});
|
|
2042
2044
|
mergedConfig.output = (0, defu.default)(mergedConfig.output ?? {}, {
|
|
2043
2045
|
copy: { assets: [
|
|
@@ -2053,14 +2055,17 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2053
2055
|
] },
|
|
2054
2056
|
dts: true
|
|
2055
2057
|
});
|
|
2056
|
-
if (
|
|
2057
|
-
if (
|
|
2058
|
-
if (
|
|
2059
|
-
if (!mergedConfig.platform) mergedConfig.platform = "neutral";
|
|
2058
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.mode)) mergedConfig.mode = await this.getDefaultMode();
|
|
2059
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.framework)) mergedConfig.framework = "powerlines";
|
|
2060
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.platform)) mergedConfig.platform = "neutral";
|
|
2060
2061
|
mergedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(mergedConfig.compatibilityDate, "latest");
|
|
2062
|
+
if (!this.packageJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
|
|
2063
|
+
await this.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
|
|
2064
|
+
if (this.packageJson) mergedConfig.organization ??= (0, _powerlines_core_plugin_utils.getPackageJsonOrganization)(this.packageJson) || "powerlines";
|
|
2065
|
+
}
|
|
2066
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
|
|
2061
2067
|
this.resolvedConfig = mergedConfig;
|
|
2062
2068
|
this.#configProxy = this.createConfigProxy();
|
|
2063
|
-
if (!this.packageJson) await this.resolvePackageConfigs();
|
|
2064
2069
|
mergedConfig.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(mergedConfig.input);
|
|
2065
2070
|
if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
|
|
2066
2071
|
mergedConfig.title ??= (0, _stryke_string_format_title_case.titleCase)(mergedConfig.name);
|
|
@@ -2071,18 +2076,18 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2071
2076
|
ret.push(plugin);
|
|
2072
2077
|
return ret;
|
|
2073
2078
|
}, []);
|
|
2074
|
-
if (
|
|
2079
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2075
2080
|
else if (mergedConfig.mode === "test") mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
|
|
2076
2081
|
else mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
2077
2082
|
mergedConfig.logLevel = (0, _powerlines_core_plugin_utils.resolveLogLevel)(mergedConfig.logLevel);
|
|
2078
|
-
if (mergedConfig.tsconfig) mergedConfig.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.tsconfig), mergedConfig.cwd);
|
|
2083
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.tsconfig)) mergedConfig.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.tsconfig), mergedConfig.cwd);
|
|
2079
2084
|
else mergedConfig.tsconfig = require_tsconfig.getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
|
|
2080
2085
|
mergedConfig.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
2081
|
-
if (mergedConfig.output.path) mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.path), mergedConfig.cwd);
|
|
2086
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.path)) mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.path), mergedConfig.cwd);
|
|
2082
2087
|
else mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(mergedConfig.root, "dist"), mergedConfig.cwd);
|
|
2083
2088
|
mergedConfig.output.copy ??= {};
|
|
2084
|
-
if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = mergedConfig.output.copy.path ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
|
|
2085
|
-
else mergedConfig.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path
|
|
2089
|
+
if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
|
|
2090
|
+
else mergedConfig.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : (0, _stryke_path_join.joinPaths)("dist", mergedConfig.root)), mergedConfig.cwd);
|
|
2086
2091
|
if (mergedConfig.output.types !== false) mergedConfig.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.types || (0, _stryke_path_join.joinPaths)(mergedConfig.root, `${mergedConfig.framework ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
|
|
2087
2092
|
if (mergedConfig.output.copy && mergedConfig.output.copy.path && mergedConfig.output.copy.assets && Array.isArray(mergedConfig.output.copy.assets)) mergedConfig.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(mergedConfig.output.copy.assets.map((asset) => {
|
|
2088
2093
|
return {
|
|
@@ -2092,11 +2097,11 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2092
2097
|
ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
|
|
2093
2098
|
};
|
|
2094
2099
|
}), (a) => `${a.input}-${a.glob}-${a.output}`);
|
|
2095
|
-
if (
|
|
2100
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
|
|
2096
2101
|
else mergedConfig.output.sourceMap = false;
|
|
2097
|
-
if (
|
|
2102
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
|
|
2098
2103
|
else mergedConfig.output.minify = false;
|
|
2099
|
-
if (
|
|
2104
|
+
if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
|
|
2100
2105
|
if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
|
|
2101
2106
|
...asset,
|
|
2102
2107
|
glob: (0, _powerlines_core_plugin_utils.replacePathTokens)(this, asset.glob),
|
|
@@ -2107,25 +2112,12 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2107
2112
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output?.storage) && mergedConfig.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(mergedConfig.output?.storage) && Object.values(mergedConfig.output.storage).every((adapter) => adapter.preset === "virtual")) mergedConfig.output.overwrite = true;
|
|
2108
2113
|
this.resolvedConfig = mergedConfig;
|
|
2109
2114
|
this.#configProxy = this.createConfigProxy();
|
|
2110
|
-
this.logger.
|
|
2115
|
+
this.logger.info({
|
|
2111
2116
|
meta: { category: "config" },
|
|
2112
|
-
message: `Resolved Powerlines configuration object: \n${
|
|
2117
|
+
message: `Resolved Powerlines configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.resolvedConfig)}`
|
|
2113
2118
|
});
|
|
2114
2119
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2115
2120
|
}
|
|
2116
|
-
logConfig(config) {
|
|
2117
|
-
return JSON.stringify({
|
|
2118
|
-
...(0, _stryke_helpers_omit.omit)(config, [
|
|
2119
|
-
"plugins",
|
|
2120
|
-
"initialConfig",
|
|
2121
|
-
"userConfig",
|
|
2122
|
-
"inlineConfig",
|
|
2123
|
-
"pluginConfig",
|
|
2124
|
-
"environmentConfig"
|
|
2125
|
-
]),
|
|
2126
|
-
plugins: config.plugins ? config.plugins.flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin)).map((plugin) => String((0, _stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : (0, _stryke_type_checks_is_set_object.isSetObject)(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin.name) ? plugin.name : Array.isArray(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
|
|
2127
|
-
}, null, 2).replace(/"([^"]+)":/g, "$1:").replace(/: "([^"]+)"/g, ": $1");
|
|
2128
|
-
}
|
|
2129
2121
|
createConfigProxy() {
|
|
2130
2122
|
return new Proxy(this.resolvedConfig, {
|
|
2131
2123
|
/**
|
|
@@ -2483,7 +2475,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
2483
2475
|
async setEnvironmentConfig(config) {
|
|
2484
2476
|
this.logger.debug({
|
|
2485
2477
|
meta: { category: "config" },
|
|
2486
|
-
message: `Updating environment configuration object: \n${
|
|
2478
|
+
message: `Updating environment configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
|
|
2487
2479
|
});
|
|
2488
2480
|
this.environmentConfig = config;
|
|
2489
2481
|
await this.resolveConfig();
|