@powerlines/core 0.48.40 → 0.48.42

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.
@@ -897,6 +897,7 @@ var PowerlinesContext = class extends require_context_base_context.PowerlinesBas
897
897
  message: `Resolved Powerlines configuration object: \n${require_plugin_utils_format.formatConfig(this.resolvedConfig)}`
898
898
  });
899
899
  this.#fs ??= await require_lib_vfs.VirtualFileSystem.create(this);
900
+ this.#checksum = await this.generateChecksum();
900
901
  }
901
902
  createConfigProxy() {
902
903
  return new Proxy(this.resolvedConfig, {
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.cts","names":[],"sources":["../../src/context/context.ts"],"mappings":";;;;;;;;;;;;;;;cAgKa,iBAAA,yBACa,cAAA,GAAiB,cAAA,oCAGjC,qBAAA,CAAsB,cAAA,aACnB,OAAA,CAAQ,eAAA,EAAiB,cAAA;EAAA;EA6dE,OAAA,EAAS,gBAAA;EA3cxC,QAAA,EAAW,QAAA;EAvBU;;;EA4BrB,WAAA,EAAc,WAAA;EAvBF;;;EA4BZ,WAAA,EAAa,MAAA;EALC;;;EAUd,UAAA,EAAa,gBAAA;EAKC;;;EAAd,YAAA,EAAc,MAAA,kBAAwB,KAAA;EAerB;;;EAVjB,eAAA,EAAiB,MAAA,kBAAwB,KAAA;EA0BxB;;;EArBjB,aAAA,EAAe,QAAA;EA0EC;;;EArEhB,eAAA,EAAiB,MAAA;EAsHb;;;EAAA,UAjHD,cAAA,EAAgB,eAAA;EAoHf;;;EAAA,UA/GD,gBAAA,EAAkB,sBAAA,CAAuB,eAAA;EAgHhD;;;EAAA,UA1GO,YAAA,EAAc,eAAA;EAmRJ;;;EAAA,UA7QV,UAAA,EAAY,eAAA;EAsUO;;;EAAA,UAjUnB,YAAA,EAAc,eAAA;EAiZc;;;EAAA,UA5Y5B,iBAAA;EA4aC;;;EAAA,cAvaG,WAAA;EAijB6C;;;EAAA,IAniBhD,KAAA,IAAS,0BAAA;EA6sB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A;;;;;;;;EA2B7C,kBAAA,CACX,IAAA,UACA,EAAA,UACA,OAAA,GAAS,WAAA,GACR,OAAA;;;;;;;;EA2BI,sBAAA,CACL,IAAA,UACA,EAAA,UACA,OAAA,GAAS,WAAA;;;;;;;EA2BE,gBAAA,CAAiB,IAAA,YAAgB,OAAA;;;;;;;EAYjC,eAAA,CACX,MAAA,EAAQ,eAAA,mBACP,OAAA;;;;;;;EAwDU,eAAA,CACX,MAAA,EAAQ,eAAA,mBACP,OAAA;;;;;;YAeO,WAAA,IAAe,eAAA;;;;;;;YA4BT,aAAA,CACd,MAAA,EAAQ,eAAA,iBACP,OAAA;;;;YAaa,aAAA,IAAiB,OAAA;EAAA,QAiWzB,iBAAA;AAAA"}
@@ -894,6 +894,7 @@ var PowerlinesContext = class extends PowerlinesBaseContext {
894
894
  message: `Resolved Powerlines configuration object: \n${formatConfig(this.resolvedConfig)}`
895
895
  });
896
896
  this.#fs ??= await VirtualFileSystem.create(this);
897
+ this.#checksum = await this.generateChecksum();
897
898
  }
898
899
  createConfigProxy() {
899
900
  return new Proxy(this.resolvedConfig, {
@@ -1 +1 @@
1
- {"version":3,"file":"context.mjs","names":["#tsconfig","#fs","#checksum","#buildId","#releaseId","#configProxy","#parserCache","#requestCache"],"sources":["../../src/context/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 { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { relativeToWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { hashDirectory } from \"@stryke/hash/node\";\nimport { getUnique, getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileDotExtensionSafe,\n findFileExtensionSafe\n} from \"@stryke/path/file-path-fns\";\nimport { isEqual } from \"@stryke/path/is-equal\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { FileReference } from \"@stryke/types/configuration\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { match, tsconfigPathsToRegExp } from \"bundle-require\";\nimport { resolveCompatibilityDates } from \"compatx\";\nimport defu from \"defu\";\nimport { create, FlatCache } from \"flat-cache\";\nimport { existsSync } from \"node:fs\";\nimport { parse, ParseResult } from \"oxc-parser\";\nimport { Range } from \"semver\";\nimport {\n Agent,\n BodyInit,\n fetch,\n interceptors,\n RequestInfo,\n Response,\n setGlobalDispatcher,\n RequestInit as UndiciRequestInit\n} from \"undici\";\nimport { UnpluginBuildContext } from \"unplugin\";\nimport {\n CACHE_HASH_LENGTH,\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL,\n ROOT_HASH_LENGTH\n} from \"../constants\";\nimport {\n getDefaultMode,\n loadParsedConfig,\n resolvePackageConfigs\n} from \"../lib/config\";\nimport { getConfigProps } from \"../lib/context-helpers\";\nimport {\n getUniqueInputs,\n isFileReference,\n resolveInputsSync\n} from \"../lib/entry\";\nimport { callHook } from \"../lib/hooks\";\nimport { getPrefixedRootHash } from \"../lib/meta\";\nimport { createResolver } from \"../lib/resolver\";\nimport { getTsconfigFilePath } from \"../lib/typescript/tsconfig\";\nimport { VirtualFileSystem } from \"../lib/vfs\";\nimport {\n formatExecutionId,\n getPackageJsonOrganization,\n getWorkspaceName\n} from \"../plugin-utils/context-helpers\";\nimport { formatConfig } from \"../plugin-utils/format\";\nimport { isDuplicate, isPlugin } from \"../plugin-utils/helpers\";\nimport { createLogger, resolveLogLevel } from \"../plugin-utils/logging\";\nimport { mergeConfig } from \"../plugin-utils/merge\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport {\n CopyConfig,\n ExecutionOptions,\n FrameworkOptions,\n InferOverridableConfig,\n ParsedUserConfig,\n PluginConfig,\n ResolvedAssetGlob,\n ResolvedConfig,\n ResolvedCopyConfig,\n ResolvedEntryFileReference,\n ResolvedOutputConfig\n} from \"../types/config\";\nimport {\n Context,\n EmitEntryOptions,\n EmitOptions,\n EnvironmentContext,\n ExecutionContext,\n FetchOptions,\n MetaInfo,\n ParseOptions,\n PluginContext,\n Resolver,\n ResolveResult,\n TransformResult\n} from \"../types/context\";\nimport {\n ResolveOptions,\n VirtualFile,\n VirtualFileSystemInterface\n} from \"../types/fs\";\nimport {\n CallHookOptions,\n InferHookParameters,\n InferHookReturnType\n} from \"../types/hooks\";\nimport {\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"../types/logging\";\nimport { ParsedTypeScriptConfig } from \"../types/tsconfig\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nconst agent = new Agent({ keepAliveTimeout: 10000 });\nsetGlobalDispatcher(\n agent.compose(\n interceptors.retry({\n maxRetries: 3,\n minTimeout: 1000,\n maxTimeout: 10000,\n timeoutFactor: 2,\n retryAfter: true\n })\n )\n);\n\nconst UNRESOLVED_CONFIG_NAMES = [\n \"userConfig\",\n \"inlineConfig\",\n \"pluginConfig\",\n \"environmentConfig\"\n];\n\nexport class PowerlinesContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesBaseContext<TSystemContext>\n implements Context<TResolvedConfig, TSystemContext>\n{\n #checksum: string | null = null;\n\n #buildId: string = uuid();\n\n #releaseId: string = uuid();\n\n #fs!: VirtualFileSystemInterface;\n\n #tsconfig!: ParsedTypeScriptConfig;\n\n #parserCache!: FlatCache;\n\n #requestCache!: FlatCache;\n\n #configProxy!: TResolvedConfig;\n\n public resolver!: Resolver;\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 * An object containing the dependencies that should be installed for the project\n */\n public dependencies: Record<string, string | Range> = {};\n\n /**\n * An object containing the development dependencies that should be installed for the project\n */\n public devDependencies: Record<string, string | Range> = {};\n\n /**\n * The persisted meta information about the current build\n */\n public persistedMeta: MetaInfo | undefined = undefined;\n\n /**\n * The resolved tsconfig file paths for the project\n */\n public resolvePatterns: RegExp[] = [];\n\n /**\n * The resolved configuration for this context\n */\n protected resolvedConfig: TResolvedConfig = {} as TResolvedConfig;\n\n /**\n * The configuration options that were overridden by plugins during the build process, which may include additional properties or modifications made during the configuration loading process.\n */\n protected overriddenConfig: InferOverridableConfig<TResolvedConfig> =\n {} as InferOverridableConfig<TResolvedConfig>;\n\n /**\n * The configuration options provided inline during execution, such as CLI flags or other parameters that may be relevant to the command being executed. These options can be used to override or supplement the configuration options defined in a configuration file on disk, and are typically provided as part of the execution context when running a Powerlines command.\n */\n protected inlineConfig: TResolvedConfig[\"inlineConfig\"] =\n {} as TResolvedConfig[\"inlineConfig\"];\n\n /**\n * The configuration options read from a configuration file on disk, which may 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 userConfig: TResolvedConfig[\"userConfig\"] = {};\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected pluginConfig: TResolvedConfig[\"pluginConfig\"] = {};\n\n /**\n * The configuration options provided by the environment\n */\n protected environmentConfig: any = {};\n\n /**\n * A unique identifier for the current execution, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n protected get executionId(): string {\n return (\n this.options.executionId ||\n formatExecutionId(\n this.config.name,\n this.config.command,\n this.options.configIndex\n )\n );\n }\n\n /**\n * The resolved entry type definitions for the project\n */\n public get entry(): ResolvedEntryFileReference[] {\n const entry = this.resolvedEntry;\n\n return resolveInputsSync(\n this,\n entry && entry.length > 0\n ? entry\n : Array.isArray(this.config.input) ||\n (isSetObject(this.config.input) &&\n !isFileReference(this.config.input))\n ? this.config.input\n : toArray(this.config.input).flat()\n );\n }\n\n /**\n * The TypeScript configuration parsed from the tsconfig file\n */\n public get tsconfig(): ParsedTypeScriptConfig {\n if (!this.#tsconfig) {\n this.tsconfig = {\n tsconfigFilePath: this.config.tsconfig\n } as ParsedTypeScriptConfig;\n }\n\n return this.#tsconfig;\n }\n\n /**\n * Sets the TypeScript configuration parsed from the tsconfig file\n */\n public set tsconfig(value: ParsedTypeScriptConfig) {\n this.#tsconfig = value;\n this.resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});\n }\n\n /**\n * The virtual file system interface for the project\n */\n public get fs(): VirtualFileSystemInterface {\n if (!this.#fs) {\n this.#fs = VirtualFileSystem.createSync(this);\n }\n\n return this.#fs;\n }\n\n /**\n * Get the checksum of the project's current state\n */\n public get checksum(): string | null {\n return this.#checksum;\n }\n\n /**\n * Invokes the configured plugin hooks\n *\n * @remarks\n * By default, it will call the `\"pre\"`, `\"normal\"`, and `\"post\"` ordered hooks in sequence\n *\n * @param hook - The hook to call\n * @param options - The options to provide to the hook\n * @param args - The arguments to pass to the hook\n * @returns The result of the hook call\n */\n public callHook = async <TKey extends string>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<any>;\n },\n ...args: InferHookParameters<PluginContext<any>, TKey>\n ): Promise<InferHookReturnType<PluginContext<any>, TKey> | undefined> =>\n callHook<TKey, TResolvedConfig>(\n this as unknown as ExecutionContext<TResolvedConfig>,\n hook,\n options,\n ...args\n );\n\n /**\n * The meta information about the current build\n */\n public get meta() {\n return {\n executionId: this.executionId,\n buildId: this.#buildId,\n releaseId: this.#releaseId,\n checksum: this.#checksum,\n timestamp: this.timestamp,\n rootHash: murmurhash(\n {\n workspaceRoot: this.config?.cwd,\n root: this.config?.root\n },\n {\n maxLength: ROOT_HASH_LENGTH\n }\n ),\n configHash: murmurhash(this.config, {\n maxLength: CACHE_HASH_LENGTH\n })\n } as MetaInfo;\n }\n\n /**\n * The resolved configuration options\n */\n public get config(): TResolvedConfig {\n if (!this.#configProxy) {\n this.#configProxy = this.createConfigProxy();\n }\n\n return this.#configProxy;\n }\n\n /**\n * Get the path to the artifacts directory for the project\n */\n public get artifactsPath(): string {\n return joinPaths(\n this.config.cwd,\n this.config.root,\n this.config.output?.artifactsPath ||\n `.${this.config.framework?.name || \"powerlines\"}`\n );\n }\n\n /**\n * Get the path to the builtin modules used by the project\n */\n public get builtinsPath(): string {\n return joinPaths(this.artifactsPath, \"builtins\");\n }\n\n /**\n * Get the path to the entry directory for the project\n */\n public get entryPath(): string {\n return joinPaths(this.artifactsPath, \"entry\");\n }\n\n /**\n * Get the path to the infrastructure modules used by the project\n */\n public get infrastructurePath(): string {\n return joinPaths(this.artifactsPath, \"infrastructure\");\n }\n\n /**\n * Get the path to the data directory for the project\n */\n public get dataPath(): string {\n return joinPaths(\n this.envPaths.data,\n \"projects\",\n getPrefixedRootHash(this.config.name, this.meta.rootHash)\n );\n }\n\n /**\n * Get the path to the cache directory for the project\n */\n public get cachePath(): string {\n return joinPaths(\n this.envPaths.cache,\n \"projects\",\n murmurhash(\n {\n checksum: this.#checksum,\n config: this.meta.configHash\n },\n {\n maxLength: CACHE_HASH_LENGTH\n }\n )\n );\n }\n\n /**\n * Get the path to the generated declaration file for the project\n */\n public get typesPath(): string {\n return this.config.output.types\n ? appendPath(this.config.output.types, this.config.cwd)\n : joinPaths(this.config.cwd, this.config.root, \"powerlines.d.ts\");\n }\n\n /**\n * Get the project root relative to the workspace root\n */\n public get relativeToWorkspaceRoot() {\n return relativeToWorkspaceRoot(this.config.root);\n }\n\n /**\n * The builtin module id that exist in the Powerlines virtual file system\n */\n public get builtins(): string[] {\n return Object.values(this.fs.metadata)\n .filter(meta => meta && meta.type === \"builtin\")\n .map(meta => meta?.id)\n .filter(Boolean);\n }\n\n /**\n * Additional arguments provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed.\n */\n public get additionalArgs(): Record<string, string | string[]> {\n return Object.entries(this.config.inlineConfig.additionalArgs ?? {}).reduce(\n (ret, [key, value]) => {\n const formattedKey = key.replace(/^--?/, \"\");\n\n if (ret[formattedKey]) {\n if (Array.isArray(ret[formattedKey])) {\n if (Array.isArray(value)) {\n ret[formattedKey] = [...toArray(ret[formattedKey]), ...value];\n } else {\n ret[formattedKey] = [...toArray(ret[formattedKey]), value];\n }\n } else {\n ret[formattedKey] = [\n ret[formattedKey],\n ...(Array.isArray(value) ? value : [value])\n ];\n }\n } else {\n ret[formattedKey] = value;\n }\n return ret;\n },\n {} as Record<string, string | string[]>\n );\n }\n\n /**\n * The alias mappings for the project used during module resolution\n *\n * @remarks\n * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.\n */\n public get alias(): Record<string, string> {\n return this.builtins.reduce(\n (ret, id) => {\n const moduleId = `${\n this.config?.framework?.name || \"powerlines\"\n }:${id.replace(/^.*:/, \"\")}`;\n if (!ret[moduleId]) {\n const path = this.fs.paths[id];\n if (path) {\n ret[moduleId] = path;\n }\n }\n\n return ret;\n },\n this.config.resolve.alias\n ? Array.isArray(this.config.resolve.alias)\n ? this.config.resolve.alias.reduce(\n (ret, alias) => {\n if (!ret[alias.find.toString()]) {\n ret[alias.find.toString()] = alias.replacement;\n }\n\n return ret;\n },\n {} as Record<string, string>\n )\n : this.config.resolve.alias\n : {}\n );\n }\n\n public override get logger(): Logger {\n return this.createLogger();\n }\n\n /**\n * The log level for the context, which determines the minimum level of log messages that will be emitted by the logger. This is resolved based on the configuration options provided by the user, and can be set to different levels for development, production, and test environments. The log level can also be overridden by plugins or other parts of the build process to provide more granular control over logging output.\n */\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.config.logLevel, this.config.mode);\n }\n\n /**\n * The environment paths for the project, which provide the locations of various directories and files used by the Powerlines framework. These paths are resolved based on the organization ID, application ID, and workspace root directory, and can be used to access configuration files, cache directories, and other resources in a consistent manner.\n */\n public override get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.config.framework?.orgId || \"storm-software\"),\n appId: kebabCase(this.config.framework?.name || \"powerlines\"),\n workspaceRoot: this.config.cwd\n });\n }\n\n /**\n * Gets the parser cache.\n */\n protected get parserCache(): FlatCache {\n if (!this.#parserCache) {\n this.#parserCache = create({\n cacheId: \"parser\",\n cacheDir: this.cachePath,\n ttl: 2 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#parserCache;\n }\n\n /**\n * Gets the request cache.\n */\n protected get requestCache(): FlatCache {\n if (!this.#requestCache) {\n this.#requestCache = create({\n cacheId: \"http\",\n cacheDir: this.cachePath,\n ttl: 6 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#requestCache;\n }\n\n /**\n * The entry points that exist in the Powerlines virtual file system\n */\n protected get resolvedEntry(): ResolvedEntryFileReference[] {\n return Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"entry\")\n .map(([path, meta]) => {\n const fileReference = {\n file: path\n } as ResolvedEntryFileReference;\n\n if (meta.properties) {\n if (isSetString(meta.properties.file)) {\n fileReference.file = meta.properties.file;\n }\n if (isSetString(meta.properties.export)) {\n fileReference.export = meta.properties.export;\n }\n if (\n isSetString(meta.properties[\"input.file\"]) ||\n isSetString(meta.properties[\"input.export\"])\n ) {\n fileReference.input ??= {} as FileReference;\n if (isSetString(meta.properties[\"input.file\"])) {\n fileReference.input.file = meta.properties[\"input.file\"];\n }\n if (isSetString(meta.properties[\"input.export\"])) {\n fileReference.input.export = meta.properties[\"input.export\"];\n }\n }\n if (isSetString(meta.properties.output)) {\n fileReference.output = meta.properties.output;\n }\n }\n\n return fileReference;\n })\n .filter(Boolean);\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 */\n protected constructor(public override options: ExecutionOptions) {\n super(options);\n }\n\n public override createLogger(options: LoggerOptions = {}) {\n return createLogger(\n this.config.name || this.options.root,\n {\n logLevel: this.logLevel,\n ...options\n },\n this.options.logFn\n );\n }\n\n /**\n * A function to perform HTTP fetch requests\n *\n * @remarks\n * This function uses a caching layer to avoid duplicate requests during the Powerlines process.\n *\n * @example\n * ```ts\n * const response = await context.fetch(\"https://api.example.com/data\");\n * const data = await response.json();\n * ```\n *\n * @see https://github.com/nodejs/undici\n *\n * @param input - The URL to fetch.\n * @param options - The fetch request options.\n * @returns A promise that resolves to a response returned by the fetch.\n */\n public async fetch(\n input: RequestInfo,\n options: FetchOptions = {}\n ): Promise<Response> {\n const { skipCache, timeout = 30000, signal, ...fetchOptions } = options;\n const url =\n typeof input === \"string\"\n ? input\n : \"url\" in input\n ? input.url\n : input.toString();\n\n const cacheKey = murmurhash({\n input: url,\n options: JSON.stringify({\n ...fetchOptions,\n timeout\n })\n });\n\n if (!this.config.skipCache && !skipCache) {\n const cached = this.requestCache.get<\n {\n body: BodyInit;\n } & Pick<Response, \"status\" | \"statusText\" | \"headers\">\n >(cacheKey);\n if (cached) {\n return new Response(cached.body, {\n status: cached.status,\n statusText: cached.statusText,\n headers: cached.headers\n });\n }\n }\n\n const logger = this.extendLogger({ category: \"communication\" });\n const startTime = Date.now();\n\n logger.trace(\n `Sending fetch request (${\n fetchOptions.method?.toUpperCase() || \"GET\"\n }): ${url}`\n );\n\n const requestController = new AbortController();\n const timeoutMs =\n typeof timeout === \"number\" && Number.isFinite(timeout) ? timeout : 30000;\n const timeoutId =\n timeoutMs > 0\n ? setTimeout(() => {\n requestController.abort(\n new Error(`Fetch request timed out after ${timeoutMs}ms`)\n );\n }, timeoutMs)\n : undefined;\n\n const onAbort = () => {\n requestController.abort(signal?.reason);\n };\n\n if (signal) {\n if (signal.aborted) {\n onAbort();\n } else {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n }\n\n let response: Response;\n try {\n response = await fetch(input, {\n ...(fetchOptions as UndiciRequestInit),\n signal: requestController.signal\n });\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (signal) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n const result = {\n body: await response.text(),\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries())\n };\n\n if (!this.config.skipCache && !skipCache) {\n try {\n this.requestCache.set(cacheKey, result);\n } catch {\n // Do nothing\n }\n }\n\n logger.trace(\n `Fetch request (${\n fetchOptions.method?.toUpperCase() || \"GET\"\n }) completed in ${Date.now() - startTime}ms: ${url} - ${\n response.status\n } / ${response.statusText} \\n - Response Headers: ${JSON.stringify(\n result.headers\n )}\\n - Response Body: ${\n typeof result.body === \"string\"\n ? result.body.length > 1000\n ? `${result.body.slice(0, 1000)}... (truncated, total length: ${\n result.body.length\n })`\n : result.body\n : \"[Non-string body]\"\n }`\n );\n\n return new Response(result.body, {\n status: result.status,\n statusText: result.statusText,\n headers: result.headers\n });\n }\n\n /**\n * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.\n *\n * @remarks\n * This function can be used to parse TypeScript code into an AST for further analysis or transformation.\n *\n * @example\n * ```ts\n * const ast = context.parse(\"const x: number = 42;\");\n * ```\n *\n * @see https://rollupjs.org/plugin-development/#this-parse\n * @see https://github.com/oxc/oxc\n *\n * @param code - The source code to parse.\n * @param options - The options to pass to the parser.\n * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.\n */\n public async parse(code: string, options: ParseOptions = {}) {\n const cacheKey = murmurhash({\n code,\n options\n });\n\n let result!: ParseResult;\n if (!this.config.skipCache) {\n result = this.parserCache.get<ParseResult>(cacheKey);\n if (result) {\n return result;\n }\n }\n\n result = await parse(`source.${options.lang || \"ts\"}`, code, {\n ...options,\n sourceType: \"module\",\n showSemanticErrors: this.config.mode === \"development\"\n });\n\n if (!this.config.skipCache) {\n this.parserCache.set(cacheKey, result);\n }\n\n return result;\n }\n\n /**\n * A helper function to resolve modules in the Virtual File System\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolved = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n public async resolve(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): Promise<ResolveResult | undefined> {\n let moduleId = id;\n if (this.config.resolve.alias) {\n if (Array.isArray(this.config.resolve.alias)) {\n const alias = this.config.resolve.alias.find(a =>\n match(moduleId, [a.find])\n );\n if (alias) {\n moduleId = alias.replacement;\n }\n } else if (\n isSetObject(this.config.resolve.alias) &&\n this.config.resolve.alias[id]\n ) {\n moduleId = this.config.resolve.alias[id];\n }\n }\n\n if (\n this.fs.isResolvableId(moduleId) ||\n (importer && this.fs.isResolvableId(importer))\n ) {\n let resolvedImporter = importer;\n if (importer && this.fs.isResolvableId(importer)) {\n resolvedImporter = await this.fs.resolve(\n importer,\n undefined,\n defu(\n {\n conditions: this.config.resolve.conditions,\n extensions: this.config.resolve.extensions\n },\n options\n )\n );\n }\n\n const result = await this.fs.resolve(\n moduleId,\n resolvedImporter,\n defu(\n {\n conditions: this.config.resolve.conditions,\n extensions: this.config.resolve.extensions\n },\n options\n )\n );\n if (!result) {\n return undefined;\n }\n\n const external = Boolean(\n !match(moduleId, this.config.resolve.noExternal) &&\n (match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\") ||\n ((!this.fs.isVirtual(moduleId, importer, options) ||\n (this.fs.isVirtual(moduleId, importer, options) &&\n this.config.projectType !== \"application\")) &&\n this.config.resolve.skipNodeModulesBundle &&\n !/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)))\n );\n\n return {\n id: result,\n external,\n virtual: !external\n };\n }\n\n if (this.config.resolve.skipNodeModulesBundle) {\n if (\n match(moduleId, this.resolvePatterns) ||\n match(moduleId, this.config.resolve.noExternal)\n ) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true, virtual: false };\n }\n\n // Exclude any other import that looks like a Node module\n if (!/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)) {\n return {\n id: moduleId,\n external: true,\n virtual: false\n };\n }\n } else {\n if (match(moduleId, this.config.resolve.noExternal)) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true, virtual: false };\n }\n }\n\n return undefined;\n }\n\n /**\n * A helper function to load modules from the Virtual File System\n *\n * @remarks\n * This function can be used to load modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const module = await context.load(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to load.\n * @returns A promise that resolves to the loaded module.\n */\n public async load(id: string): Promise<TransformResult | undefined> {\n const resolvedId = await this.fs.resolve(id);\n if (!resolvedId) {\n return undefined;\n }\n\n const code = await this.fs.read(resolvedId);\n if (!code) {\n return undefined;\n }\n\n return { code, map: null };\n }\n\n /**\n * Get the builtin virtual files that exist in the Powerlines virtual file system\n */\n public async getBuiltins() {\n return Promise.all(\n Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"builtin\")\n .map(async ([id, meta]) => {\n const code = await this.fs.read(id);\n const path = this.fs.paths[id];\n\n return { ...meta, path, code } as VirtualFile;\n })\n );\n }\n\n /**\n * Resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public async emit(\n code: string,\n path: string,\n options: EmitOptions = {}\n ): Promise<void> {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.write(filePath, code, options);\n }\n\n /**\n * Synchronously resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public emitSync(code: string, path: string, options: EmitOptions = {}) {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.writeSync(filePath, code, options);\n }\n\n /**\n * Resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public async emitEntry(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): Promise<void> {\n return this.emit(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n export: options?.export,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.export\": options?.input?.export\n }\n }\n },\n omit(options, [\"export\"])\n )\n );\n }\n\n /**\n * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public emitEntrySync(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): void {\n return this.emitSync(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n export: options?.export,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.export\": options?.input?.export\n }\n }\n },\n omit(options, [\"export\"])\n )\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public async emitBuiltin(\n code: string,\n id: string,\n options: EmitOptions = {}\n ): Promise<void> {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emit(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public emitBuiltinSync(code: string, id: string, options: EmitOptions = {}) {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emitSync(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public async emitInfrastructure(\n code: string,\n id: string,\n options: EmitOptions = {}\n ): Promise<void> {\n if (!this.infrastructurePath) {\n throw new Error(\n `The infrastructure path is not set. Cannot emit infrastructure file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The infrastructure id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emit(\n code,\n appendPath(id, this.infrastructurePath),\n defu(options, { meta: { type: \"infrastructure\", id } })\n );\n }\n\n /**\n * Synchronously resolves an infrastructure virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the infrastructure file\n * @param id - The unique identifier of the infrastructure file\n * @param options - Optional write file options\n */\n public emitInfrastructureSync(\n code: string,\n id: string,\n options: EmitOptions = {}\n ) {\n if (!this.infrastructurePath) {\n throw new Error(\n `The infrastructure path is not set. Cannot emit infrastructure file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The infrastructure id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emitSync(\n code,\n appendPath(id, this.infrastructurePath),\n defu(options, { meta: { type: \"infrastructure\", id } })\n );\n }\n\n /**\n * Generates a checksum representing the current context state\n *\n * @param path - The root directory of the project to generate the checksum for\n * @returns A promise that resolves to a string representing the checksum\n */\n public async generateChecksum(path?: string): Promise<string> {\n return hashDirectory(\n path || appendPath(this.options.root, this.options.cwd)\n );\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating inline configuration object: \\n${formatConfig(config)}`\n });\n\n this.inlineConfig = config;\n this.#checksum = await this.generateChecksum();\n\n this.configFile = await loadParsedConfig(\n this.options.cwd,\n this.options.root,\n this.options.framework?.name || \"powerlines\",\n this.options.framework?.orgId || \"storm-software\",\n config\n );\n\n const configIndex = this.options.configIndex ?? 0;\n\n const result =\n this.configFile.config &&\n toArray(this.configFile.config).length > configIndex\n ? toArray(this.configFile.config)[configIndex]!\n : this.configFile.config;\n if (!result) {\n this.logger.warn(\n `No configuration found in ${\n this.options.configFile\n } for execution index ${this.options.configIndex}.`\n );\n } else {\n await this.setUserConfig(\n (isFunction(result)\n ? await Promise.resolve(\n result({\n cwd: this.cwd,\n root: this.options.root,\n mode:\n this.inlineConfig.mode ||\n (await getDefaultMode(this.cwd, this.options.root)),\n command: this.inlineConfig.command\n })\n )\n : result) as TResolvedConfig[\"userConfig\"]\n );\n }\n\n await this.resolveConfig();\n }\n\n /**\n * A setter function to populate the plugin config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the plugin configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any plugin configuration provided during execution.\n *\n * @param config - The plugin configuration values to set.\n * @returns A promise that resolves when the plugin configuration values have been set.\n */\n public async setPluginConfig(\n config: TResolvedConfig[\"pluginConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating plugin configuration object: \\n${formatConfig(config)}`\n });\n\n this.pluginConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected mergeConfig(): TResolvedConfig {\n return mergeConfig(\n {\n inlineConfig: this.inlineConfig,\n userConfig: this.userConfig,\n pluginConfig: this.pluginConfig,\n environmentConfig: this.environmentConfig\n },\n getConfigProps<TResolvedConfig>(this.overriddenConfig),\n this.options,\n getConfigProps<TResolvedConfig>(this.inlineConfig),\n getConfigProps<TResolvedConfig>(this.userConfig),\n getConfigProps<TResolvedConfig>(this.pluginConfig),\n {\n version: this.packageJson?.version,\n description: this.packageJson?.description,\n environments: {},\n resolve: {}\n }\n ) as TResolvedConfig;\n }\n\n /**\n * A setter function to populate the user config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the user configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The user configuration values to set.\n * @returns A promise that resolves when the user configuration values have been set.\n */\n protected async setUserConfig(\n config: TResolvedConfig[\"userConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating user configuration object: \\n${formatConfig(config)}`\n });\n\n this.userConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Initialize the context with the provided configuration options\n */\n protected async resolveConfig(): Promise<void> {\n const mergedConfig = this.mergeConfig();\n\n this.logger.trace({\n meta: { category: \"config\" },\n message: `Pre-setup Powerlines configuration object: \\n --- Merged Config --- \\n${formatConfig(\n mergedConfig\n )} \\n\\n --- User Config --- \\n${formatConfig(\n this.userConfig\n )} \\n\\n --- Inline Config --- \\n${formatConfig(\n this.inlineConfig\n )} \\n\\n --- Plugin Config --- \\n${formatConfig(\n this.pluginConfig\n )} \\n\\n --- Environment Config --- \\n${formatConfig(\n this.environmentConfig\n )} \\n\\n --- Overridden Config --- \\n${formatConfig(\n this.overriddenConfig\n )}`\n });\n\n mergedConfig.output = defu(mergedConfig.output ?? {}, {\n copy: {\n assets: [\n {\n glob: \"LICENSE\"\n },\n {\n input: mergedConfig.root,\n glob: \"*.md\"\n },\n {\n input: mergedConfig.root,\n glob: \"package.json\"\n }\n ]\n },\n dts: true\n }) as ResolvedOutputConfig;\n\n if (isUndefined(mergedConfig.mode)) {\n mergedConfig.mode = await getDefaultMode(this.cwd, mergedConfig.root);\n }\n\n if (\n isUndefined(mergedConfig.framework) ||\n !isSetString(mergedConfig.framework.name)\n ) {\n mergedConfig.framework ??= {} as FrameworkOptions;\n mergedConfig.framework.name ??=\n (await getWorkspaceName(this)) || \"powerlines\";\n }\n\n if (isUndefined(mergedConfig.platform)) {\n mergedConfig.platform = \"neutral\";\n }\n\n mergedConfig.compatibilityDate = resolveCompatibilityDates(\n mergedConfig.compatibilityDate,\n \"latest\"\n );\n\n if (\n (!this.packageJson &&\n existsSync(\n joinPaths(\n appendPath(mergedConfig.root, mergedConfig.cwd),\n \"package.json\"\n )\n )) ||\n (!this.projectJson &&\n existsSync(\n joinPaths(\n appendPath(mergedConfig.root, mergedConfig.cwd),\n \"project.json\"\n )\n ))\n ) {\n const result = await resolvePackageConfigs(\n mergedConfig.cwd,\n mergedConfig.root\n );\n if (result) {\n if (result.packageJson) {\n this.packageJson = result.packageJson;\n }\n if (result.projectJson) {\n this.projectJson = result.projectJson;\n }\n\n if (this.packageJson) {\n mergedConfig.framework ??= {} as FrameworkOptions;\n mergedConfig.framework.name ??=\n (await getWorkspaceName(this)) || \"powerlines\";\n mergedConfig.framework.orgId ??=\n getPackageJsonOrganization(this.packageJson) || \"storm-software\";\n }\n }\n }\n\n if (isUndefined(mergedConfig.projectType)) {\n mergedConfig.projectType = this.projectJson?.projectType || \"application\";\n }\n\n this.resolvedConfig = mergedConfig;\n this.#configProxy = this.createConfigProxy();\n\n mergedConfig.input = getUniqueInputs(mergedConfig.input);\n\n if (\n mergedConfig.name?.startsWith(\"@\") &&\n mergedConfig.name.split(\"/\").filter(Boolean).length > 1\n ) {\n mergedConfig.name = mergedConfig.name.split(\"/\").filter(Boolean)[1]!;\n }\n\n mergedConfig.title ??= titleCase(mergedConfig.name);\n\n if (mergedConfig.resolve.external) {\n mergedConfig.resolve.external = getUnique(mergedConfig.resolve.external);\n }\n if (mergedConfig.resolve.noExternal) {\n mergedConfig.resolve.noExternal = getUnique(\n mergedConfig.resolve.noExternal\n );\n }\n\n mergedConfig.plugins = (mergedConfig.plugins ?? [])\n .flatMap(plugin => toArray(plugin))\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n isDuplicate(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n\n if (isUndefined(mergedConfig.logLevel)) {\n if (mergedConfig.mode === \"development\") {\n mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mergedConfig.mode === \"test\") {\n mergedConfig.logLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n mergedConfig.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n }\n\n mergedConfig.logLevel = resolveLogLevel(mergedConfig.logLevel);\n\n if (isSetString(mergedConfig.tsconfig)) {\n mergedConfig.tsconfig = replacePath(\n replacePathTokens(this, mergedConfig.tsconfig),\n mergedConfig.cwd\n );\n } else {\n mergedConfig.tsconfig = getTsconfigFilePath(\n mergedConfig.cwd,\n mergedConfig.root\n );\n }\n\n // #region Configure output\n\n mergedConfig.output.format = getUnique(\n toArray(\n mergedConfig.output?.format ??\n (mergedConfig.projectType === \"library\" ? [\"cjs\", \"esm\"] : [\"esm\"])\n )\n );\n\n if (isSetString(mergedConfig.output.path)) {\n mergedConfig.output.path = appendPath(\n replacePathTokens(this, mergedConfig.output.path),\n mergedConfig.cwd\n );\n } else {\n mergedConfig.output.path = appendPath(\n joinPaths(mergedConfig.root, \"dist\"),\n mergedConfig.cwd\n );\n }\n\n mergedConfig.output.copy ??= {} as ResolvedCopyConfig;\n if (mergedConfig.output.copy !== false) {\n if (!mergedConfig.root.replace(/^\\.\\/?/, \"\")) {\n mergedConfig.output.copy.path = isSetString(\n mergedConfig.output.copy.path\n )\n ? appendPath(\n replacePathTokens(this, mergedConfig.output.copy.path),\n mergedConfig.cwd\n )\n : mergedConfig.output.path;\n } else {\n mergedConfig.output.copy.path = appendPath(\n replacePathTokens(\n this,\n isSetString(mergedConfig.output.copy.path)\n ? mergedConfig.output.copy.path\n : joinPaths(\"dist\", mergedConfig.root)\n ),\n mergedConfig.cwd\n );\n }\n }\n\n if (mergedConfig.output.types !== false) {\n mergedConfig.output.types = appendPath(\n replacePathTokens(\n this,\n mergedConfig.output.types ||\n joinPaths(\n mergedConfig.root,\n `${mergedConfig.framework?.name ?? \"powerlines\"}.d.ts`\n )\n ),\n mergedConfig.cwd\n );\n }\n\n if (\n mergedConfig.output.copy &&\n mergedConfig.output.copy.path &&\n mergedConfig.output.copy.assets &&\n Array.isArray(mergedConfig.output.copy.assets)\n ) {\n mergedConfig.output.copy.assets = getUniqueBy(\n mergedConfig.output.copy.assets.map(asset => {\n return {\n glob: isSetObject(asset) ? asset.glob : asset,\n input:\n isString(asset) ||\n !asset.input ||\n asset.input === \".\" ||\n asset.input === \"/\" ||\n asset.input === \"./\"\n ? mergedConfig.cwd\n : isParentPath(asset.input, mergedConfig.cwd) ||\n isEqual(asset.input, mergedConfig.cwd)\n ? asset.input\n : appendPath(asset.input, mergedConfig.cwd),\n output:\n isSetObject(asset) && isSetString(asset.output)\n ? isParentPath(asset.output, mergedConfig.cwd)\n ? asset.output\n : appendPath(\n joinPaths(\n (mergedConfig.output.copy as CopyConfig).path,\n replacePath(\n replacePath(\n asset.output,\n replacePath(\n (mergedConfig.output.copy as CopyConfig).path,\n mergedConfig.cwd\n )\n ),\n (mergedConfig.output.copy as CopyConfig).path\n )\n ),\n mergedConfig.cwd\n )\n : appendPath(\n (mergedConfig.output.copy as CopyConfig).path,\n mergedConfig.cwd\n ),\n ignore:\n isSetObject(asset) && asset.ignore\n ? toArray(asset.ignore)\n : undefined\n };\n }),\n (a: ResolvedAssetGlob) => `${a.input}-${a.glob}-${a.output}`\n );\n }\n\n if (isUndefined(mergedConfig.output?.sourceMap)) {\n if (mergedConfig.mode === \"development\") {\n mergedConfig.output.sourceMap = true;\n } else {\n mergedConfig.output.sourceMap = false;\n }\n }\n\n if (isUndefined(mergedConfig.output?.minify)) {\n if (mergedConfig.mode === \"production\") {\n mergedConfig.output.minify = true;\n } else {\n mergedConfig.output.minify = false;\n }\n }\n\n if (isUndefined(mergedConfig.output?.artifactsPath)) {\n mergedConfig.output.artifactsPath = `.${\n mergedConfig.framework?.name ?? \"powerlines\"\n }`;\n }\n\n if (mergedConfig.output.copy && mergedConfig.output.copy.assets) {\n mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map(\n asset => ({\n ...asset,\n glob: replacePathTokens(this, asset.glob),\n ignore: asset.ignore\n ? asset.ignore.map(ignore => replacePathTokens(this, ignore))\n : undefined,\n input: replacePathTokens(this, asset.input),\n output: replacePathTokens(this, asset.output)\n })\n );\n }\n\n if (\n (isSetString(mergedConfig.output?.storage) &&\n mergedConfig.output.storage === \"virtual\") ||\n (isSetObject(mergedConfig.output?.storage) &&\n Object.values(mergedConfig.output.storage).every(\n adapter => adapter.preset === \"virtual\"\n ))\n ) {\n mergedConfig.output.overwrite = true;\n }\n\n // #endregion Configure output\n\n this.resolvedConfig = mergedConfig;\n this.#configProxy = this.createConfigProxy();\n\n this.resolver = createResolver({\n cwd: this.resolvedConfig.cwd,\n root: this.resolvedConfig.root,\n cacheDir: this.envPaths.cache,\n mode: this.resolvedConfig.mode\n });\n\n this.logger.info({\n meta: { category: \"config\" },\n message: `Resolved Powerlines configuration object: \\n${formatConfig(\n this.resolvedConfig\n )}`\n });\n\n this.#fs ??= await VirtualFileSystem.create(this);\n }\n\n private createConfigProxy(): TResolvedConfig {\n return new Proxy(this.resolvedConfig, {\n /**\n * A trap for the `delete` operator.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to delete.\n * @returns A `boolean` indicating whether or not the property was deleted.\n */\n deleteProperty: (target: TResolvedConfig, key) => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n throw new Error(\n `Cannot delete property ${key.toString()} from config - it is only intended to be used as a reference.`\n );\n }\n\n Reflect.deleteProperty(this.overriddenConfig, key);\n return Reflect.deleteProperty(target, key);\n },\n\n /**\n * A trap for getting a property value.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to get.\n * @param receiver - The proxy or an object that inherits from the proxy.\n */\n get: (target: TResolvedConfig, key, receiver) => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n if (key === \"cwd\") {\n return this.cwd;\n }\n if (key === \"userConfig\") {\n return this.userConfig;\n }\n if (key === \"inlineConfig\") {\n return this.inlineConfig;\n }\n if (key === \"pluginConfig\") {\n return this.pluginConfig;\n }\n if (key === \"environmentConfig\") {\n return this.environmentConfig;\n }\n }\n\n return Reflect.get(target, key, receiver);\n },\n\n /**\n * A trap for the `in` operator.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to check for existence.\n */\n has: (target: TResolvedConfig, key: string | symbol): boolean => {\n return (\n Reflect.has(target, key) ||\n UNRESOLVED_CONFIG_NAMES.includes(key.toString())\n );\n },\n\n /**\n * A trap for `Reflect.ownKeys()`.\n * @param target - The original object which is being proxied.\n */\n ownKeys: (target: TResolvedConfig): ArrayLike<string | symbol> => {\n return getUnique([\n ...Reflect.ownKeys(target),\n ...UNRESOLVED_CONFIG_NAMES\n ]);\n },\n\n /**\n * A trap for setting a property value.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to set.\n * @param newValue - The new value to assign to the property.\n * @param receiver - The object to which the assignment was originally directed.\n * @returns A `boolean` indicating whether or not the property was set.\n */\n set: (\n target: TResolvedConfig,\n key: string | symbol,\n newValue: any,\n receiver: any\n ): boolean => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n throw new Error(\n `Cannot change property ${key.toString()} from config - it is only intended to be used as a reference.`\n );\n }\n\n Reflect.set(this.overriddenConfig, key, newValue, receiver);\n return Reflect.set(target, key, newValue, receiver);\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IA,oBACE,IAFgB,MAAM,EAAE,kBAAkB,IAAM,CAE5C,EAAE,QACJ,aAAa,MAAM;CACjB,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,YAAY;AACd,CAAC,CACH,CACF;AAEA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;AACF;AAEA,IAAa,oBAAb,cAIU,sBAEV;CA4dwC;CA3dtC,YAA2B;CAE3B,WAAmB,KAAK;CAExB,aAAqB,KAAK;CAE1B;CAEA;CAEA;CAEA;CAEA;CAEA,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO,cAA+C;;;;CAKtD,AAAO;;;;CAKP,AAAO,eAA+C,CAAC;;;;CAKvD,AAAO,kBAAkD,CAAC;;;;CAK1D,AAAO,gBAAsC;;;;CAK7C,AAAO,kBAA4B,CAAC;;;;CAKpC,AAAU,iBAAkC,CAAC;;;;CAK7C,AAAU,mBACR,CAAC;;;;CAKH,AAAU,eACR,CAAC;;;;CAKH,AAAU,aAA4C,CAAC;;;;CAKvD,AAAU,eAAgD,CAAC;;;;CAK3D,AAAU,oBAAyB,CAAC;;;;CAKpC,IAAc,cAAsB;EAClC,OACE,KAAK,QAAQ,eACb,kBACE,KAAK,OAAO,MACZ,KAAK,OAAO,SACZ,KAAK,QAAQ,WACf;CAEJ;;;;CAKA,IAAW,Q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AU,QAAQ;GACpD;EACF,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"context.mjs","names":["#tsconfig","#fs","#checksum","#buildId","#releaseId","#configProxy","#parserCache","#requestCache"],"sources":["../../src/context/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 { toArray } from \"@stryke/convert/to-array\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { relativeToWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { hashDirectory } from \"@stryke/hash/node\";\nimport { getUnique, getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport {\n findFileDotExtensionSafe,\n findFileExtensionSafe\n} from \"@stryke/path/file-path-fns\";\nimport { isEqual } from \"@stryke/path/is-equal\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { FileReference } from \"@stryke/types/configuration\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { match, tsconfigPathsToRegExp } from \"bundle-require\";\nimport { resolveCompatibilityDates } from \"compatx\";\nimport defu from \"defu\";\nimport { create, FlatCache } from \"flat-cache\";\nimport { existsSync } from \"node:fs\";\nimport { parse, ParseResult } from \"oxc-parser\";\nimport { Range } from \"semver\";\nimport {\n Agent,\n BodyInit,\n fetch,\n interceptors,\n RequestInfo,\n Response,\n setGlobalDispatcher,\n RequestInit as UndiciRequestInit\n} from \"undici\";\nimport { UnpluginBuildContext } from \"unplugin\";\nimport {\n CACHE_HASH_LENGTH,\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL,\n ROOT_HASH_LENGTH\n} from \"../constants\";\nimport {\n getDefaultMode,\n loadParsedConfig,\n resolvePackageConfigs\n} from \"../lib/config\";\nimport { getConfigProps } from \"../lib/context-helpers\";\nimport {\n getUniqueInputs,\n isFileReference,\n resolveInputsSync\n} from \"../lib/entry\";\nimport { callHook } from \"../lib/hooks\";\nimport { getPrefixedRootHash } from \"../lib/meta\";\nimport { createResolver } from \"../lib/resolver\";\nimport { getTsconfigFilePath } from \"../lib/typescript/tsconfig\";\nimport { VirtualFileSystem } from \"../lib/vfs\";\nimport {\n formatExecutionId,\n getPackageJsonOrganization,\n getWorkspaceName\n} from \"../plugin-utils/context-helpers\";\nimport { formatConfig } from \"../plugin-utils/format\";\nimport { isDuplicate, isPlugin } from \"../plugin-utils/helpers\";\nimport { createLogger, resolveLogLevel } from \"../plugin-utils/logging\";\nimport { mergeConfig } from \"../plugin-utils/merge\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport {\n CopyConfig,\n ExecutionOptions,\n FrameworkOptions,\n InferOverridableConfig,\n ParsedUserConfig,\n PluginConfig,\n ResolvedAssetGlob,\n ResolvedConfig,\n ResolvedCopyConfig,\n ResolvedEntryFileReference,\n ResolvedOutputConfig\n} from \"../types/config\";\nimport {\n Context,\n EmitEntryOptions,\n EmitOptions,\n EnvironmentContext,\n ExecutionContext,\n FetchOptions,\n MetaInfo,\n ParseOptions,\n PluginContext,\n Resolver,\n ResolveResult,\n TransformResult\n} from \"../types/context\";\nimport {\n ResolveOptions,\n VirtualFile,\n VirtualFileSystemInterface\n} from \"../types/fs\";\nimport {\n CallHookOptions,\n InferHookParameters,\n InferHookReturnType\n} from \"../types/hooks\";\nimport {\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig\n} from \"../types/logging\";\nimport { ParsedTypeScriptConfig } from \"../types/tsconfig\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nconst agent = new Agent({ keepAliveTimeout: 10000 });\nsetGlobalDispatcher(\n agent.compose(\n interceptors.retry({\n maxRetries: 3,\n minTimeout: 1000,\n maxTimeout: 10000,\n timeoutFactor: 2,\n retryAfter: true\n })\n )\n);\n\nconst UNRESOLVED_CONFIG_NAMES = [\n \"userConfig\",\n \"inlineConfig\",\n \"pluginConfig\",\n \"environmentConfig\"\n];\n\nexport class PowerlinesContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesBaseContext<TSystemContext>\n implements Context<TResolvedConfig, TSystemContext>\n{\n #checksum: string | null = null;\n\n #buildId: string = uuid();\n\n #releaseId: string = uuid();\n\n #fs!: VirtualFileSystemInterface;\n\n #tsconfig!: ParsedTypeScriptConfig;\n\n #parserCache!: FlatCache;\n\n #requestCache!: FlatCache;\n\n #configProxy!: TResolvedConfig;\n\n public resolver!: Resolver;\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 * An object containing the dependencies that should be installed for the project\n */\n public dependencies: Record<string, string | Range> = {};\n\n /**\n * An object containing the development dependencies that should be installed for the project\n */\n public devDependencies: Record<string, string | Range> = {};\n\n /**\n * The persisted meta information about the current build\n */\n public persistedMeta: MetaInfo | undefined = undefined;\n\n /**\n * The resolved tsconfig file paths for the project\n */\n public resolvePatterns: RegExp[] = [];\n\n /**\n * The resolved configuration for this context\n */\n protected resolvedConfig: TResolvedConfig = {} as TResolvedConfig;\n\n /**\n * The configuration options that were overridden by plugins during the build process, which may include additional properties or modifications made during the configuration loading process.\n */\n protected overriddenConfig: InferOverridableConfig<TResolvedConfig> =\n {} as InferOverridableConfig<TResolvedConfig>;\n\n /**\n * The configuration options provided inline during execution, such as CLI flags or other parameters that may be relevant to the command being executed. These options can be used to override or supplement the configuration options defined in a configuration file on disk, and are typically provided as part of the execution context when running a Powerlines command.\n */\n protected inlineConfig: TResolvedConfig[\"inlineConfig\"] =\n {} as TResolvedConfig[\"inlineConfig\"];\n\n /**\n * The configuration options read from a configuration file on disk, which may 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 userConfig: TResolvedConfig[\"userConfig\"] = {};\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected pluginConfig: TResolvedConfig[\"pluginConfig\"] = {};\n\n /**\n * The configuration options provided by the environment\n */\n protected environmentConfig: any = {};\n\n /**\n * A unique identifier for the current execution, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n protected get executionId(): string {\n return (\n this.options.executionId ||\n formatExecutionId(\n this.config.name,\n this.config.command,\n this.options.configIndex\n )\n );\n }\n\n /**\n * The resolved entry type definitions for the project\n */\n public get entry(): ResolvedEntryFileReference[] {\n const entry = this.resolvedEntry;\n\n return resolveInputsSync(\n this,\n entry && entry.length > 0\n ? entry\n : Array.isArray(this.config.input) ||\n (isSetObject(this.config.input) &&\n !isFileReference(this.config.input))\n ? this.config.input\n : toArray(this.config.input).flat()\n );\n }\n\n /**\n * The TypeScript configuration parsed from the tsconfig file\n */\n public get tsconfig(): ParsedTypeScriptConfig {\n if (!this.#tsconfig) {\n this.tsconfig = {\n tsconfigFilePath: this.config.tsconfig\n } as ParsedTypeScriptConfig;\n }\n\n return this.#tsconfig;\n }\n\n /**\n * Sets the TypeScript configuration parsed from the tsconfig file\n */\n public set tsconfig(value: ParsedTypeScriptConfig) {\n this.#tsconfig = value;\n this.resolvePatterns = tsconfigPathsToRegExp(value?.options?.paths ?? {});\n }\n\n /**\n * The virtual file system interface for the project\n */\n public get fs(): VirtualFileSystemInterface {\n if (!this.#fs) {\n this.#fs = VirtualFileSystem.createSync(this);\n }\n\n return this.#fs;\n }\n\n /**\n * Get the checksum of the project's current state\n */\n public get checksum(): string | null {\n return this.#checksum;\n }\n\n /**\n * Invokes the configured plugin hooks\n *\n * @remarks\n * By default, it will call the `\"pre\"`, `\"normal\"`, and `\"post\"` ordered hooks in sequence\n *\n * @param hook - The hook to call\n * @param options - The options to provide to the hook\n * @param args - The arguments to pass to the hook\n * @returns The result of the hook call\n */\n public callHook = async <TKey extends string>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<any>;\n },\n ...args: InferHookParameters<PluginContext<any>, TKey>\n ): Promise<InferHookReturnType<PluginContext<any>, TKey> | undefined> =>\n callHook<TKey, TResolvedConfig>(\n this as unknown as ExecutionContext<TResolvedConfig>,\n hook,\n options,\n ...args\n );\n\n /**\n * The meta information about the current build\n */\n public get meta() {\n return {\n executionId: this.executionId,\n buildId: this.#buildId,\n releaseId: this.#releaseId,\n checksum: this.#checksum,\n timestamp: this.timestamp,\n rootHash: murmurhash(\n {\n workspaceRoot: this.config?.cwd,\n root: this.config?.root\n },\n {\n maxLength: ROOT_HASH_LENGTH\n }\n ),\n configHash: murmurhash(this.config, {\n maxLength: CACHE_HASH_LENGTH\n })\n } as MetaInfo;\n }\n\n /**\n * The resolved configuration options\n */\n public get config(): TResolvedConfig {\n if (!this.#configProxy) {\n this.#configProxy = this.createConfigProxy();\n }\n\n return this.#configProxy;\n }\n\n /**\n * Get the path to the artifacts directory for the project\n */\n public get artifactsPath(): string {\n return joinPaths(\n this.config.cwd,\n this.config.root,\n this.config.output?.artifactsPath ||\n `.${this.config.framework?.name || \"powerlines\"}`\n );\n }\n\n /**\n * Get the path to the builtin modules used by the project\n */\n public get builtinsPath(): string {\n return joinPaths(this.artifactsPath, \"builtins\");\n }\n\n /**\n * Get the path to the entry directory for the project\n */\n public get entryPath(): string {\n return joinPaths(this.artifactsPath, \"entry\");\n }\n\n /**\n * Get the path to the infrastructure modules used by the project\n */\n public get infrastructurePath(): string {\n return joinPaths(this.artifactsPath, \"infrastructure\");\n }\n\n /**\n * Get the path to the data directory for the project\n */\n public get dataPath(): string {\n return joinPaths(\n this.envPaths.data,\n \"projects\",\n getPrefixedRootHash(this.config.name, this.meta.rootHash)\n );\n }\n\n /**\n * Get the path to the cache directory for the project\n */\n public get cachePath(): string {\n return joinPaths(\n this.envPaths.cache,\n \"projects\",\n murmurhash(\n {\n checksum: this.#checksum,\n config: this.meta.configHash\n },\n {\n maxLength: CACHE_HASH_LENGTH\n }\n )\n );\n }\n\n /**\n * Get the path to the generated declaration file for the project\n */\n public get typesPath(): string {\n return this.config.output.types\n ? appendPath(this.config.output.types, this.config.cwd)\n : joinPaths(this.config.cwd, this.config.root, \"powerlines.d.ts\");\n }\n\n /**\n * Get the project root relative to the workspace root\n */\n public get relativeToWorkspaceRoot() {\n return relativeToWorkspaceRoot(this.config.root);\n }\n\n /**\n * The builtin module id that exist in the Powerlines virtual file system\n */\n public get builtins(): string[] {\n return Object.values(this.fs.metadata)\n .filter(meta => meta && meta.type === \"builtin\")\n .map(meta => meta?.id)\n .filter(Boolean);\n }\n\n /**\n * Additional arguments provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed.\n */\n public get additionalArgs(): Record<string, string | string[]> {\n return Object.entries(this.config.inlineConfig.additionalArgs ?? {}).reduce(\n (ret, [key, value]) => {\n const formattedKey = key.replace(/^--?/, \"\");\n\n if (ret[formattedKey]) {\n if (Array.isArray(ret[formattedKey])) {\n if (Array.isArray(value)) {\n ret[formattedKey] = [...toArray(ret[formattedKey]), ...value];\n } else {\n ret[formattedKey] = [...toArray(ret[formattedKey]), value];\n }\n } else {\n ret[formattedKey] = [\n ret[formattedKey],\n ...(Array.isArray(value) ? value : [value])\n ];\n }\n } else {\n ret[formattedKey] = value;\n }\n return ret;\n },\n {} as Record<string, string | string[]>\n );\n }\n\n /**\n * The alias mappings for the project used during module resolution\n *\n * @remarks\n * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.\n */\n public get alias(): Record<string, string> {\n return this.builtins.reduce(\n (ret, id) => {\n const moduleId = `${\n this.config?.framework?.name || \"powerlines\"\n }:${id.replace(/^.*:/, \"\")}`;\n if (!ret[moduleId]) {\n const path = this.fs.paths[id];\n if (path) {\n ret[moduleId] = path;\n }\n }\n\n return ret;\n },\n this.config.resolve.alias\n ? Array.isArray(this.config.resolve.alias)\n ? this.config.resolve.alias.reduce(\n (ret, alias) => {\n if (!ret[alias.find.toString()]) {\n ret[alias.find.toString()] = alias.replacement;\n }\n\n return ret;\n },\n {} as Record<string, string>\n )\n : this.config.resolve.alias\n : {}\n );\n }\n\n public override get logger(): Logger {\n return this.createLogger();\n }\n\n /**\n * The log level for the context, which determines the minimum level of log messages that will be emitted by the logger. This is resolved based on the configuration options provided by the user, and can be set to different levels for development, production, and test environments. The log level can also be overridden by plugins or other parts of the build process to provide more granular control over logging output.\n */\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.config.logLevel, this.config.mode);\n }\n\n /**\n * The environment paths for the project, which provide the locations of various directories and files used by the Powerlines framework. These paths are resolved based on the organization ID, application ID, and workspace root directory, and can be used to access configuration files, cache directories, and other resources in a consistent manner.\n */\n public override get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: kebabCase(this.config.framework?.orgId || \"storm-software\"),\n appId: kebabCase(this.config.framework?.name || \"powerlines\"),\n workspaceRoot: this.config.cwd\n });\n }\n\n /**\n * Gets the parser cache.\n */\n protected get parserCache(): FlatCache {\n if (!this.#parserCache) {\n this.#parserCache = create({\n cacheId: \"parser\",\n cacheDir: this.cachePath,\n ttl: 2 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#parserCache;\n }\n\n /**\n * Gets the request cache.\n */\n protected get requestCache(): FlatCache {\n if (!this.#requestCache) {\n this.#requestCache = create({\n cacheId: \"http\",\n cacheDir: this.cachePath,\n ttl: 6 * 60 * 60 * 1000,\n lruSize: 5000,\n persistInterval: 250\n });\n }\n\n return this.#requestCache;\n }\n\n /**\n * The entry points that exist in the Powerlines virtual file system\n */\n protected get resolvedEntry(): ResolvedEntryFileReference[] {\n return Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"entry\")\n .map(([path, meta]) => {\n const fileReference = {\n file: path\n } as ResolvedEntryFileReference;\n\n if (meta.properties) {\n if (isSetString(meta.properties.file)) {\n fileReference.file = meta.properties.file;\n }\n if (isSetString(meta.properties.export)) {\n fileReference.export = meta.properties.export;\n }\n if (\n isSetString(meta.properties[\"input.file\"]) ||\n isSetString(meta.properties[\"input.export\"])\n ) {\n fileReference.input ??= {} as FileReference;\n if (isSetString(meta.properties[\"input.file\"])) {\n fileReference.input.file = meta.properties[\"input.file\"];\n }\n if (isSetString(meta.properties[\"input.export\"])) {\n fileReference.input.export = meta.properties[\"input.export\"];\n }\n }\n if (isSetString(meta.properties.output)) {\n fileReference.output = meta.properties.output;\n }\n }\n\n return fileReference;\n })\n .filter(Boolean);\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 */\n protected constructor(public override options: ExecutionOptions) {\n super(options);\n }\n\n public override createLogger(options: LoggerOptions = {}) {\n return createLogger(\n this.config.name || this.options.root,\n {\n logLevel: this.logLevel,\n ...options\n },\n this.options.logFn\n );\n }\n\n /**\n * A function to perform HTTP fetch requests\n *\n * @remarks\n * This function uses a caching layer to avoid duplicate requests during the Powerlines process.\n *\n * @example\n * ```ts\n * const response = await context.fetch(\"https://api.example.com/data\");\n * const data = await response.json();\n * ```\n *\n * @see https://github.com/nodejs/undici\n *\n * @param input - The URL to fetch.\n * @param options - The fetch request options.\n * @returns A promise that resolves to a response returned by the fetch.\n */\n public async fetch(\n input: RequestInfo,\n options: FetchOptions = {}\n ): Promise<Response> {\n const { skipCache, timeout = 30000, signal, ...fetchOptions } = options;\n const url =\n typeof input === \"string\"\n ? input\n : \"url\" in input\n ? input.url\n : input.toString();\n\n const cacheKey = murmurhash({\n input: url,\n options: JSON.stringify({\n ...fetchOptions,\n timeout\n })\n });\n\n if (!this.config.skipCache && !skipCache) {\n const cached = this.requestCache.get<\n {\n body: BodyInit;\n } & Pick<Response, \"status\" | \"statusText\" | \"headers\">\n >(cacheKey);\n if (cached) {\n return new Response(cached.body, {\n status: cached.status,\n statusText: cached.statusText,\n headers: cached.headers\n });\n }\n }\n\n const logger = this.extendLogger({ category: \"communication\" });\n const startTime = Date.now();\n\n logger.trace(\n `Sending fetch request (${\n fetchOptions.method?.toUpperCase() || \"GET\"\n }): ${url}`\n );\n\n const requestController = new AbortController();\n const timeoutMs =\n typeof timeout === \"number\" && Number.isFinite(timeout) ? timeout : 30000;\n const timeoutId =\n timeoutMs > 0\n ? setTimeout(() => {\n requestController.abort(\n new Error(`Fetch request timed out after ${timeoutMs}ms`)\n );\n }, timeoutMs)\n : undefined;\n\n const onAbort = () => {\n requestController.abort(signal?.reason);\n };\n\n if (signal) {\n if (signal.aborted) {\n onAbort();\n } else {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n }\n\n let response: Response;\n try {\n response = await fetch(input, {\n ...(fetchOptions as UndiciRequestInit),\n signal: requestController.signal\n });\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (signal) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n const result = {\n body: await response.text(),\n status: response.status,\n statusText: response.statusText,\n headers: Object.fromEntries(response.headers.entries())\n };\n\n if (!this.config.skipCache && !skipCache) {\n try {\n this.requestCache.set(cacheKey, result);\n } catch {\n // Do nothing\n }\n }\n\n logger.trace(\n `Fetch request (${\n fetchOptions.method?.toUpperCase() || \"GET\"\n }) completed in ${Date.now() - startTime}ms: ${url} - ${\n response.status\n } / ${response.statusText} \\n - Response Headers: ${JSON.stringify(\n result.headers\n )}\\n - Response Body: ${\n typeof result.body === \"string\"\n ? result.body.length > 1000\n ? `${result.body.slice(0, 1000)}... (truncated, total length: ${\n result.body.length\n })`\n : result.body\n : \"[Non-string body]\"\n }`\n );\n\n return new Response(result.body, {\n status: result.status,\n statusText: result.statusText,\n headers: result.headers\n });\n }\n\n /**\n * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.\n *\n * @remarks\n * This function can be used to parse TypeScript code into an AST for further analysis or transformation.\n *\n * @example\n * ```ts\n * const ast = context.parse(\"const x: number = 42;\");\n * ```\n *\n * @see https://rollupjs.org/plugin-development/#this-parse\n * @see https://github.com/oxc/oxc\n *\n * @param code - The source code to parse.\n * @param options - The options to pass to the parser.\n * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.\n */\n public async parse(code: string, options: ParseOptions = {}) {\n const cacheKey = murmurhash({\n code,\n options\n });\n\n let result!: ParseResult;\n if (!this.config.skipCache) {\n result = this.parserCache.get<ParseResult>(cacheKey);\n if (result) {\n return result;\n }\n }\n\n result = await parse(`source.${options.lang || \"ts\"}`, code, {\n ...options,\n sourceType: \"module\",\n showSemanticErrors: this.config.mode === \"development\"\n });\n\n if (!this.config.skipCache) {\n this.parserCache.set(cacheKey, result);\n }\n\n return result;\n }\n\n /**\n * A helper function to resolve modules in the Virtual File System\n *\n * @remarks\n * This function can be used to resolve modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const resolved = await context.resolve(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to resolve.\n * @param importer - An optional path to the importer module.\n * @param options - Additional resolution options.\n * @returns A promise that resolves to the resolved module path.\n */\n public async resolve(\n id: string,\n importer?: string,\n options: ResolveOptions = {}\n ): Promise<ResolveResult | undefined> {\n let moduleId = id;\n if (this.config.resolve.alias) {\n if (Array.isArray(this.config.resolve.alias)) {\n const alias = this.config.resolve.alias.find(a =>\n match(moduleId, [a.find])\n );\n if (alias) {\n moduleId = alias.replacement;\n }\n } else if (\n isSetObject(this.config.resolve.alias) &&\n this.config.resolve.alias[id]\n ) {\n moduleId = this.config.resolve.alias[id];\n }\n }\n\n if (\n this.fs.isResolvableId(moduleId) ||\n (importer && this.fs.isResolvableId(importer))\n ) {\n let resolvedImporter = importer;\n if (importer && this.fs.isResolvableId(importer)) {\n resolvedImporter = await this.fs.resolve(\n importer,\n undefined,\n defu(\n {\n conditions: this.config.resolve.conditions,\n extensions: this.config.resolve.extensions\n },\n options\n )\n );\n }\n\n const result = await this.fs.resolve(\n moduleId,\n resolvedImporter,\n defu(\n {\n conditions: this.config.resolve.conditions,\n extensions: this.config.resolve.extensions\n },\n options\n )\n );\n if (!result) {\n return undefined;\n }\n\n const external = Boolean(\n !match(moduleId, this.config.resolve.noExternal) &&\n (match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\") ||\n ((!this.fs.isVirtual(moduleId, importer, options) ||\n (this.fs.isVirtual(moduleId, importer, options) &&\n this.config.projectType !== \"application\")) &&\n this.config.resolve.skipNodeModulesBundle &&\n !/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)))\n );\n\n return {\n id: result,\n external,\n virtual: !external\n };\n }\n\n if (this.config.resolve.skipNodeModulesBundle) {\n if (\n match(moduleId, this.resolvePatterns) ||\n match(moduleId, this.config.resolve.noExternal)\n ) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true, virtual: false };\n }\n\n // Exclude any other import that looks like a Node module\n if (!/^[A-Z]:[/\\\\]|^\\.{0,2}\\/|^\\.{1,2}$/.test(moduleId)) {\n return {\n id: moduleId,\n external: true,\n virtual: false\n };\n }\n } else {\n if (match(moduleId, this.config.resolve.noExternal)) {\n return undefined;\n }\n\n if (\n match(moduleId, this.config.resolve.external) ||\n moduleId.startsWith(\"node:\")\n ) {\n return { id: moduleId, external: true, virtual: false };\n }\n }\n\n return undefined;\n }\n\n /**\n * A helper function to load modules from the Virtual File System\n *\n * @remarks\n * This function can be used to load modules relative to the project root directory.\n *\n * @example\n * ```ts\n * const module = await context.load(\"some-module\", \"/path/to/importer\");\n * ```\n *\n * @param id - The module to load.\n * @returns A promise that resolves to the loaded module.\n */\n public async load(id: string): Promise<TransformResult | undefined> {\n const resolvedId = await this.fs.resolve(id);\n if (!resolvedId) {\n return undefined;\n }\n\n const code = await this.fs.read(resolvedId);\n if (!code) {\n return undefined;\n }\n\n return { code, map: null };\n }\n\n /**\n * Get the builtin virtual files that exist in the Powerlines virtual file system\n */\n public async getBuiltins() {\n return Promise.all(\n Object.entries(this.fs.metadata)\n .filter(([, meta]) => meta && meta.type === \"builtin\")\n .map(async ([id, meta]) => {\n const code = await this.fs.read(id);\n const path = this.fs.paths[id];\n\n return { ...meta, path, code } as VirtualFile;\n })\n );\n }\n\n /**\n * Resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public async emit(\n code: string,\n path: string,\n options: EmitOptions = {}\n ): Promise<void> {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.write(filePath, code, options);\n }\n\n /**\n * Synchronously resolves a file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the file\n * @param path - The path to write the file to\n * @param options - Additional options for writing the file\n */\n public emitSync(code: string, path: string, options: EmitOptions = {}) {\n const filePath = options.extension\n ? findFileExtensionSafe(path)\n ? options.extension.startsWith(\".\")\n ? path.replace(findFileDotExtensionSafe(path), options.extension)\n : path.replace(findFileExtensionSafe(path), options.extension)\n : options.extension.startsWith(\".\")\n ? `${path}${options.extension}`\n : `${path}.${options.extension}`\n : findFileExtensionSafe(path)\n ? path\n : `${path}.ts`;\n\n if (\n isFunction((this as unknown as UnpluginBuildContext).emitFile) &&\n options.emitWithBundler\n ) {\n return (this as unknown as UnpluginBuildContext).emitFile({\n needsCodeReference: options.needsCodeReference,\n originalFileName: options.originalFileName,\n fileName: filePath,\n source: code,\n type: \"asset\"\n });\n }\n\n return this.fs.writeSync(filePath, code, options);\n }\n\n /**\n * Resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public async emitEntry(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): Promise<void> {\n return this.emit(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n export: options?.export,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.export\": options?.input?.export\n }\n }\n },\n omit(options, [\"export\"])\n )\n );\n }\n\n /**\n * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the entry file\n * @param path - A path to write the entry file to\n * @param options - Optional write file options\n */\n public emitEntrySync(\n code: string,\n path: string,\n options: EmitEntryOptions = {}\n ): void {\n return this.emitSync(\n code,\n appendPath(path, this.entryPath),\n defu(\n {\n meta: {\n type: \"entry\",\n properties: {\n file: appendPath(path, this.entryPath),\n export: options?.export,\n output: options?.output,\n \"input.file\": options?.input?.file,\n \"input.export\": options?.input?.export\n }\n }\n },\n omit(options, [\"export\"])\n )\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public async emitBuiltin(\n code: string,\n id: string,\n options: EmitOptions = {}\n ): Promise<void> {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emit(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public emitBuiltinSync(code: string, id: string, options: EmitOptions = {}) {\n if (!this.builtinsPath) {\n throw new Error(\n `The builtins path is not set. Cannot emit builtin file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The builtin id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emitSync(\n code,\n appendPath(id, this.builtinsPath),\n defu(options, { meta: { type: \"builtin\", id } })\n );\n }\n\n /**\n * Resolves a builtin virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the builtin file\n * @param id - The unique identifier of the builtin file\n * @param options - Optional write file options\n */\n public async emitInfrastructure(\n code: string,\n id: string,\n options: EmitOptions = {}\n ): Promise<void> {\n if (!this.infrastructurePath) {\n throw new Error(\n `The infrastructure path is not set. Cannot emit infrastructure file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The infrastructure id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emit(\n code,\n appendPath(id, this.infrastructurePath),\n defu(options, { meta: { type: \"infrastructure\", id } })\n );\n }\n\n /**\n * Synchronously resolves an infrastructure virtual file and writes it to the VFS if it does not already exist\n *\n * @param code - The source code of the infrastructure file\n * @param id - The unique identifier of the infrastructure file\n * @param options - Optional write file options\n */\n public emitInfrastructureSync(\n code: string,\n id: string,\n options: EmitOptions = {}\n ) {\n if (!this.infrastructurePath) {\n throw new Error(\n `The infrastructure path is not set. Cannot emit infrastructure file with id \"${id}\".`\n );\n }\n\n if (!isSetString(id)) {\n throw new Error(\n `The infrastructure id must be a non-empty string. Received: ${String(id)}`\n );\n }\n\n return this.emitSync(\n code,\n appendPath(id, this.infrastructurePath),\n defu(options, { meta: { type: \"infrastructure\", id } })\n );\n }\n\n /**\n * Generates a checksum representing the current context state\n *\n * @param path - The root directory of the project to generate the checksum for\n * @returns A promise that resolves to a string representing the checksum\n */\n public async generateChecksum(path?: string): Promise<string> {\n return hashDirectory(\n path || appendPath(this.options.root, this.options.cwd)\n );\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating inline configuration object: \\n${formatConfig(config)}`\n });\n\n this.inlineConfig = config;\n this.#checksum = await this.generateChecksum();\n\n this.configFile = await loadParsedConfig(\n this.options.cwd,\n this.options.root,\n this.options.framework?.name || \"powerlines\",\n this.options.framework?.orgId || \"storm-software\",\n config\n );\n\n const configIndex = this.options.configIndex ?? 0;\n\n const result =\n this.configFile.config &&\n toArray(this.configFile.config).length > configIndex\n ? toArray(this.configFile.config)[configIndex]!\n : this.configFile.config;\n if (!result) {\n this.logger.warn(\n `No configuration found in ${\n this.options.configFile\n } for execution index ${this.options.configIndex}.`\n );\n } else {\n await this.setUserConfig(\n (isFunction(result)\n ? await Promise.resolve(\n result({\n cwd: this.cwd,\n root: this.options.root,\n mode:\n this.inlineConfig.mode ||\n (await getDefaultMode(this.cwd, this.options.root)),\n command: this.inlineConfig.command\n })\n )\n : result) as TResolvedConfig[\"userConfig\"]\n );\n }\n\n await this.resolveConfig();\n }\n\n /**\n * A setter function to populate the plugin config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the plugin configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any plugin configuration provided during execution.\n *\n * @param config - The plugin configuration values to set.\n * @returns A promise that resolves when the plugin configuration values have been set.\n */\n public async setPluginConfig(\n config: TResolvedConfig[\"pluginConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating plugin configuration object: \\n${formatConfig(config)}`\n });\n\n this.pluginConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected mergeConfig(): TResolvedConfig {\n return mergeConfig(\n {\n inlineConfig: this.inlineConfig,\n userConfig: this.userConfig,\n pluginConfig: this.pluginConfig,\n environmentConfig: this.environmentConfig\n },\n getConfigProps<TResolvedConfig>(this.overriddenConfig),\n this.options,\n getConfigProps<TResolvedConfig>(this.inlineConfig),\n getConfigProps<TResolvedConfig>(this.userConfig),\n getConfigProps<TResolvedConfig>(this.pluginConfig),\n {\n version: this.packageJson?.version,\n description: this.packageJson?.description,\n environments: {},\n resolve: {}\n }\n ) as TResolvedConfig;\n }\n\n /**\n * A setter function to populate the user config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the user configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The user configuration values to set.\n * @returns A promise that resolves when the user configuration values have been set.\n */\n protected async setUserConfig(\n config: TResolvedConfig[\"userConfig\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating user configuration object: \\n${formatConfig(config)}`\n });\n\n this.userConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Initialize the context with the provided configuration options\n */\n protected async resolveConfig(): Promise<void> {\n const mergedConfig = this.mergeConfig();\n\n this.logger.trace({\n meta: { category: \"config\" },\n message: `Pre-setup Powerlines configuration object: \\n --- Merged Config --- \\n${formatConfig(\n mergedConfig\n )} \\n\\n --- User Config --- \\n${formatConfig(\n this.userConfig\n )} \\n\\n --- Inline Config --- \\n${formatConfig(\n this.inlineConfig\n )} \\n\\n --- Plugin Config --- \\n${formatConfig(\n this.pluginConfig\n )} \\n\\n --- Environment Config --- \\n${formatConfig(\n this.environmentConfig\n )} \\n\\n --- Overridden Config --- \\n${formatConfig(\n this.overriddenConfig\n )}`\n });\n\n mergedConfig.output = defu(mergedConfig.output ?? {}, {\n copy: {\n assets: [\n {\n glob: \"LICENSE\"\n },\n {\n input: mergedConfig.root,\n glob: \"*.md\"\n },\n {\n input: mergedConfig.root,\n glob: \"package.json\"\n }\n ]\n },\n dts: true\n }) as ResolvedOutputConfig;\n\n if (isUndefined(mergedConfig.mode)) {\n mergedConfig.mode = await getDefaultMode(this.cwd, mergedConfig.root);\n }\n\n if (\n isUndefined(mergedConfig.framework) ||\n !isSetString(mergedConfig.framework.name)\n ) {\n mergedConfig.framework ??= {} as FrameworkOptions;\n mergedConfig.framework.name ??=\n (await getWorkspaceName(this)) || \"powerlines\";\n }\n\n if (isUndefined(mergedConfig.platform)) {\n mergedConfig.platform = \"neutral\";\n }\n\n mergedConfig.compatibilityDate = resolveCompatibilityDates(\n mergedConfig.compatibilityDate,\n \"latest\"\n );\n\n if (\n (!this.packageJson &&\n existsSync(\n joinPaths(\n appendPath(mergedConfig.root, mergedConfig.cwd),\n \"package.json\"\n )\n )) ||\n (!this.projectJson &&\n existsSync(\n joinPaths(\n appendPath(mergedConfig.root, mergedConfig.cwd),\n \"project.json\"\n )\n ))\n ) {\n const result = await resolvePackageConfigs(\n mergedConfig.cwd,\n mergedConfig.root\n );\n if (result) {\n if (result.packageJson) {\n this.packageJson = result.packageJson;\n }\n if (result.projectJson) {\n this.projectJson = result.projectJson;\n }\n\n if (this.packageJson) {\n mergedConfig.framework ??= {} as FrameworkOptions;\n mergedConfig.framework.name ??=\n (await getWorkspaceName(this)) || \"powerlines\";\n mergedConfig.framework.orgId ??=\n getPackageJsonOrganization(this.packageJson) || \"storm-software\";\n }\n }\n }\n\n if (isUndefined(mergedConfig.projectType)) {\n mergedConfig.projectType = this.projectJson?.projectType || \"application\";\n }\n\n this.resolvedConfig = mergedConfig;\n this.#configProxy = this.createConfigProxy();\n\n mergedConfig.input = getUniqueInputs(mergedConfig.input);\n\n if (\n mergedConfig.name?.startsWith(\"@\") &&\n mergedConfig.name.split(\"/\").filter(Boolean).length > 1\n ) {\n mergedConfig.name = mergedConfig.name.split(\"/\").filter(Boolean)[1]!;\n }\n\n mergedConfig.title ??= titleCase(mergedConfig.name);\n\n if (mergedConfig.resolve.external) {\n mergedConfig.resolve.external = getUnique(mergedConfig.resolve.external);\n }\n if (mergedConfig.resolve.noExternal) {\n mergedConfig.resolve.noExternal = getUnique(\n mergedConfig.resolve.noExternal\n );\n }\n\n mergedConfig.plugins = (mergedConfig.plugins ?? [])\n .flatMap(plugin => toArray(plugin))\n .filter(Boolean)\n .reduce((ret, plugin) => {\n if (\n isPlugin(plugin) &&\n isDuplicate(\n plugin,\n ret.filter(p => isPlugin(p))\n )\n ) {\n return ret;\n }\n\n ret.push(plugin);\n\n return ret;\n }, [] as PluginConfig[]);\n\n if (isUndefined(mergedConfig.logLevel)) {\n if (mergedConfig.mode === \"development\") {\n mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mergedConfig.mode === \"test\") {\n mergedConfig.logLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n mergedConfig.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n }\n\n mergedConfig.logLevel = resolveLogLevel(mergedConfig.logLevel);\n\n if (isSetString(mergedConfig.tsconfig)) {\n mergedConfig.tsconfig = replacePath(\n replacePathTokens(this, mergedConfig.tsconfig),\n mergedConfig.cwd\n );\n } else {\n mergedConfig.tsconfig = getTsconfigFilePath(\n mergedConfig.cwd,\n mergedConfig.root\n );\n }\n\n // #region Configure output\n\n mergedConfig.output.format = getUnique(\n toArray(\n mergedConfig.output?.format ??\n (mergedConfig.projectType === \"library\" ? [\"cjs\", \"esm\"] : [\"esm\"])\n )\n );\n\n if (isSetString(mergedConfig.output.path)) {\n mergedConfig.output.path = appendPath(\n replacePathTokens(this, mergedConfig.output.path),\n mergedConfig.cwd\n );\n } else {\n mergedConfig.output.path = appendPath(\n joinPaths(mergedConfig.root, \"dist\"),\n mergedConfig.cwd\n );\n }\n\n mergedConfig.output.copy ??= {} as ResolvedCopyConfig;\n if (mergedConfig.output.copy !== false) {\n if (!mergedConfig.root.replace(/^\\.\\/?/, \"\")) {\n mergedConfig.output.copy.path = isSetString(\n mergedConfig.output.copy.path\n )\n ? appendPath(\n replacePathTokens(this, mergedConfig.output.copy.path),\n mergedConfig.cwd\n )\n : mergedConfig.output.path;\n } else {\n mergedConfig.output.copy.path = appendPath(\n replacePathTokens(\n this,\n isSetString(mergedConfig.output.copy.path)\n ? mergedConfig.output.copy.path\n : joinPaths(\"dist\", mergedConfig.root)\n ),\n mergedConfig.cwd\n );\n }\n }\n\n if (mergedConfig.output.types !== false) {\n mergedConfig.output.types = appendPath(\n replacePathTokens(\n this,\n mergedConfig.output.types ||\n joinPaths(\n mergedConfig.root,\n `${mergedConfig.framework?.name ?? \"powerlines\"}.d.ts`\n )\n ),\n mergedConfig.cwd\n );\n }\n\n if (\n mergedConfig.output.copy &&\n mergedConfig.output.copy.path &&\n mergedConfig.output.copy.assets &&\n Array.isArray(mergedConfig.output.copy.assets)\n ) {\n mergedConfig.output.copy.assets = getUniqueBy(\n mergedConfig.output.copy.assets.map(asset => {\n return {\n glob: isSetObject(asset) ? asset.glob : asset,\n input:\n isString(asset) ||\n !asset.input ||\n asset.input === \".\" ||\n asset.input === \"/\" ||\n asset.input === \"./\"\n ? mergedConfig.cwd\n : isParentPath(asset.input, mergedConfig.cwd) ||\n isEqual(asset.input, mergedConfig.cwd)\n ? asset.input\n : appendPath(asset.input, mergedConfig.cwd),\n output:\n isSetObject(asset) && isSetString(asset.output)\n ? isParentPath(asset.output, mergedConfig.cwd)\n ? asset.output\n : appendPath(\n joinPaths(\n (mergedConfig.output.copy as CopyConfig).path,\n replacePath(\n replacePath(\n asset.output,\n replacePath(\n (mergedConfig.output.copy as CopyConfig).path,\n mergedConfig.cwd\n )\n ),\n (mergedConfig.output.copy as CopyConfig).path\n )\n ),\n mergedConfig.cwd\n )\n : appendPath(\n (mergedConfig.output.copy as CopyConfig).path,\n mergedConfig.cwd\n ),\n ignore:\n isSetObject(asset) && asset.ignore\n ? toArray(asset.ignore)\n : undefined\n };\n }),\n (a: ResolvedAssetGlob) => `${a.input}-${a.glob}-${a.output}`\n );\n }\n\n if (isUndefined(mergedConfig.output?.sourceMap)) {\n if (mergedConfig.mode === \"development\") {\n mergedConfig.output.sourceMap = true;\n } else {\n mergedConfig.output.sourceMap = false;\n }\n }\n\n if (isUndefined(mergedConfig.output?.minify)) {\n if (mergedConfig.mode === \"production\") {\n mergedConfig.output.minify = true;\n } else {\n mergedConfig.output.minify = false;\n }\n }\n\n if (isUndefined(mergedConfig.output?.artifactsPath)) {\n mergedConfig.output.artifactsPath = `.${\n mergedConfig.framework?.name ?? \"powerlines\"\n }`;\n }\n\n if (mergedConfig.output.copy && mergedConfig.output.copy.assets) {\n mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map(\n asset => ({\n ...asset,\n glob: replacePathTokens(this, asset.glob),\n ignore: asset.ignore\n ? asset.ignore.map(ignore => replacePathTokens(this, ignore))\n : undefined,\n input: replacePathTokens(this, asset.input),\n output: replacePathTokens(this, asset.output)\n })\n );\n }\n\n if (\n (isSetString(mergedConfig.output?.storage) &&\n mergedConfig.output.storage === \"virtual\") ||\n (isSetObject(mergedConfig.output?.storage) &&\n Object.values(mergedConfig.output.storage).every(\n adapter => adapter.preset === \"virtual\"\n ))\n ) {\n mergedConfig.output.overwrite = true;\n }\n\n // #endregion Configure output\n\n this.resolvedConfig = mergedConfig;\n this.#configProxy = this.createConfigProxy();\n\n this.resolver = createResolver({\n cwd: this.resolvedConfig.cwd,\n root: this.resolvedConfig.root,\n cacheDir: this.envPaths.cache,\n mode: this.resolvedConfig.mode\n });\n\n this.logger.info({\n meta: { category: \"config\" },\n message: `Resolved Powerlines configuration object: \\n${formatConfig(\n this.resolvedConfig\n )}`\n });\n\n this.#fs ??= await VirtualFileSystem.create(this);\n this.#checksum = await this.generateChecksum();\n }\n\n private createConfigProxy(): TResolvedConfig {\n return new Proxy(this.resolvedConfig, {\n /**\n * A trap for the `delete` operator.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to delete.\n * @returns A `boolean` indicating whether or not the property was deleted.\n */\n deleteProperty: (target: TResolvedConfig, key) => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n throw new Error(\n `Cannot delete property ${key.toString()} from config - it is only intended to be used as a reference.`\n );\n }\n\n Reflect.deleteProperty(this.overriddenConfig, key);\n return Reflect.deleteProperty(target, key);\n },\n\n /**\n * A trap for getting a property value.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to get.\n * @param receiver - The proxy or an object that inherits from the proxy.\n */\n get: (target: TResolvedConfig, key, receiver) => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n if (key === \"cwd\") {\n return this.cwd;\n }\n if (key === \"userConfig\") {\n return this.userConfig;\n }\n if (key === \"inlineConfig\") {\n return this.inlineConfig;\n }\n if (key === \"pluginConfig\") {\n return this.pluginConfig;\n }\n if (key === \"environmentConfig\") {\n return this.environmentConfig;\n }\n }\n\n return Reflect.get(target, key, receiver);\n },\n\n /**\n * A trap for the `in` operator.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to check for existence.\n */\n has: (target: TResolvedConfig, key: string | symbol): boolean => {\n return (\n Reflect.has(target, key) ||\n UNRESOLVED_CONFIG_NAMES.includes(key.toString())\n );\n },\n\n /**\n * A trap for `Reflect.ownKeys()`.\n * @param target - The original object which is being proxied.\n */\n ownKeys: (target: TResolvedConfig): ArrayLike<string | symbol> => {\n return getUnique([\n ...Reflect.ownKeys(target),\n ...UNRESOLVED_CONFIG_NAMES\n ]);\n },\n\n /**\n * A trap for setting a property value.\n * @param target - The original object which is being proxied.\n * @param key - The name or `Symbol` of the property to set.\n * @param newValue - The new value to assign to the property.\n * @param receiver - The object to which the assignment was originally directed.\n * @returns A `boolean` indicating whether or not the property was set.\n */\n set: (\n target: TResolvedConfig,\n key: string | symbol,\n newValue: any,\n receiver: any\n ): boolean => {\n if (UNRESOLVED_CONFIG_NAMES.includes(key.toString())) {\n throw new Error(\n `Cannot change property ${key.toString()} from config - it is only intended to be used as a reference.`\n );\n }\n\n Reflect.set(this.overriddenConfig, key, newValue, receiver);\n return Reflect.set(target, key, newValue, receiver);\n }\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6IA,oBACE,IAFgB,MAAM,EAAE,kBAAkB,IAAM,CAE5C,EAAE,QACJ,aAAa,MAAM;CACjB,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,eAAe;CACf,YAAY;AACd,CAAC,CACH,CACF;AAEA,MAAM,0BAA0B;CAC9B;CACA;CACA;CACA;AACF;AAEA,IAAa,oBAAb,cAIU,sBA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AO,KAAK;KAEd,IAAI,QAAQ,gBACV,OAAO,KAAK;KAEd,IAAI,QAAQ,gBACV,OAAO,KAAK;KAEd,IAAI,QAAQ,qBACV,OAAO,KAAK;IAEhB;IAEA,OAAO,QAAQ,IAAI,QAAQ,KAAK,QAAQ;GAC1C;;;;;;GAOA,MAAM,QAAyB,QAAkC;IAC/D,OACE,QAAQ,IAAI,QAAQ,GAAG,KACvB,wBAAwB,SAAS,IAAI,SAAS,CAAC;GAEnD;;;;;GAMA,UAAU,WAAwD;IAChE,OAAO,UAAU,CACf,GAAG,QAAQ,QAAQ,MAAM,GACzB,GAAG,uBACL,CAAC;GACH;;;;;;;;;GAUA,MACE,QACA,KACA,UACA,aACY;IACZ,IAAI,wBAAwB,SAAS,IAAI,SAAS,CAAC,GACjD,MAAM,IAAI,MACR,0BAA0B,IAAI,SAAS,EAAE,8DAC3C;IAGF,QAAQ,IAAI,KAAK,kBAAkB,KAAK,UAAU,QAAQ;IAC1D,OAAO,QAAQ,IAAI,QAAQ,KAAK,UAAU,QAAQ;GACpD;EACF,CAAC;CACH;AACF"}
@@ -19,10 +19,13 @@ async function resolvePluginConfig(context) {
19
19
  meta: { category: "plugins" },
20
20
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
21
21
  });
22
- else context.info({
23
- meta: { category: "plugins" },
24
- message: `Loaded ${context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(context.config.framework?.name ?? "powerlines")} plugin${context.plugins.length > 1 ? "s" : ""}: \n${context.plugins.map((plugin, index) => ` ${index + 1}. ${require_plugin_utils_logging.colorText(plugin.name)}`).join("\n")}`
25
- });
22
+ else {
23
+ const pluginNumberWidth = context.plugins.length >= 10 ? String(context.plugins.length).length : 1;
24
+ context.info({
25
+ meta: { category: "plugins" },
26
+ message: `Loaded ${context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(context.config.framework?.name ?? "powerlines")} plugin${context.plugins.length > 1 ? "s" : ""}: \n${context.plugins.map((plugin, index) => `${String(index + 1).padStart(pluginNumberWidth, "0")}. ${require_plugin_utils_logging.colorText(plugin.name)}`).join("\n")}`
27
+ });
28
+ }
26
29
  const pluginConfig = await context.callHook("config", {
27
30
  environment: await context.getEnvironment(),
28
31
  sequential: true,
@@ -18,10 +18,13 @@ async function resolvePluginConfig(context) {
18
18
  meta: { category: "plugins" },
19
19
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
20
20
  });
21
- else context.info({
22
- meta: { category: "plugins" },
23
- message: `Loaded ${context.plugins.length} ${titleCase(context.config.framework?.name ?? "powerlines")} plugin${context.plugins.length > 1 ? "s" : ""}: \n${context.plugins.map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`).join("\n")}`
24
- });
21
+ else {
22
+ const pluginNumberWidth = context.plugins.length >= 10 ? String(context.plugins.length).length : 1;
23
+ context.info({
24
+ meta: { category: "plugins" },
25
+ message: `Loaded ${context.plugins.length} ${titleCase(context.config.framework?.name ?? "powerlines")} plugin${context.plugins.length > 1 ? "s" : ""}: \n${context.plugins.map((plugin, index) => `${String(index + 1).padStart(pluginNumberWidth, "0")}. ${colorText(plugin.name)}`).join("\n")}`
26
+ });
27
+ }
25
28
  const pluginConfig = await context.callHook("config", {
26
29
  environment: await context.getEnvironment(),
27
30
  sequential: true,
@@ -1 +1 @@
1
- {"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/lib/context-helpers.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 { toArray } from \"@stryke/convert/to-array\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { colorText } from \"../plugin-utils/logging\";\nimport type {\n ExecutionContext,\n InferOverridableConfig,\n PluginConfig,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { mergeConfigs } from \"./hooks\";\n\nexport function getConfigProps<TResolvedConfig extends ResolvedConfig>(\n config:\n | TResolvedConfig[\"userConfig\"]\n | TResolvedConfig[\"inlineConfig\"]\n | TResolvedConfig[\"pluginConfig\"]\n | InferOverridableConfig<TResolvedConfig> = {}\n) {\n return {\n input: isSetString(config.input) ? [config.input] : config.input,\n ...config\n };\n}\n\nexport async function resolvePluginConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends ExecutionContext<TResolvedConfig, TSystemContext> =\n ExecutionContext<TResolvedConfig, TSystemContext>\n>(context: TContext) {\n const timer = context.timer(\n `${titleCase(context.config.command)} Execution - Initialization`\n );\n\n for (const plugin of (\n context.config.plugins as PluginConfig<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n ).flatMap(p => toArray(p)) ?? []) {\n await context.unstable_addPlugin(plugin);\n }\n\n if (context.plugins.length === 0) {\n context.warn({\n meta: {\n category: \"plugins\"\n },\n message:\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n });\n } else {\n context.info({\n meta: {\n category: \"plugins\"\n },\n message: `Loaded ${context.plugins.length} ${titleCase(\n context.config.framework?.name ?? \"powerlines\"\n )} plugin${context.plugins.length > 1 ? \"s\" : \"\"}: \\n${context.plugins\n .map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`)\n .join(\"\\n\")}`\n });\n }\n\n const pluginConfig = await context.callHook(\"config\", {\n environment: await context.getEnvironment(),\n sequential: true,\n result: \"merge\",\n merge: mergeConfigs\n });\n if (pluginConfig) {\n await context.setPluginConfig(\n pluginConfig as TContext[\"config\"][\"pluginConfig\"]\n );\n } else {\n context.debug({\n meta: {\n category: \"config\"\n },\n message: \"No plugin configuration was returned from the config hook.\"\n });\n }\n\n timer();\n}\n"],"mappings":";;;;;;;AA+BA,SAAgB,eACd,SAI8C,CAAC,GAC/C;CACA,OAAO;EACL,OAAO,YAAY,OAAO,KAAK,IAAI,CAAC,OAAO,KAAK,IAAI,OAAO;EAC3D,GAAG;CACL;AACF;AAEA,eAAsB,oBAKpB,SAAmB;CACnB,MAAM,QAAQ,QAAQ,MACpB,GAAG,UAAU,QAAQ,OAAO,OAAO,EAAE,4BACvC;CAEA,KAAK,MAAM,UACT,QAAQ,OAAO,QAGf,SAAQ,MAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,GAC7B,MAAM,QAAQ,mBAAmB,MAAM;CAGzC,IAAI,QAAQ,QAAQ,WAAW,GAC7B,QAAQ,KAAK;EACX,MAAM,EACJ,UAAU,UACZ;EACA,SACE;CACJ,CAAC;MAED,QAAQ,KAAK;EACX,MAAM,EACJ,UAAU,UACZ;EACA,SAAS,UAAU,QAAQ,QAAQ,OAAO,GAAG,UAC3C,QAAQ,OAAO,WAAW,QAAQ,YACpC,EAAE,SAAS,QAAQ,QAAQ,SAAS,IAAI,MAAM,GAAG,MAAM,QAAQ,QAC5D,KAAK,QAAQ,UAAU,IAAI,QAAQ,EAAE,IAAI,UAAU,OAAO,IAAI,GAAG,EACjE,KAAK,IAAI;CACd,CAAC;CAGH,MAAM,eAAe,MAAM,QAAQ,SAAS,UAAU;EACpD,aAAa,MAAM,QAAQ,eAAe;EAC1C,YAAY;EACZ,QAAQ;EACR,OAAO;CACT,CAAC;CACD,IAAI,cACF,MAAM,QAAQ,gBACZ,YACF;MAEA,QAAQ,MAAM;EACZ,MAAM,EACJ,UAAU,SACZ;EACA,SAAS;CACX,CAAC;CAGH,MAAM;AACR"}
1
+ {"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/lib/context-helpers.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 { toArray } from \"@stryke/convert/to-array\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { colorText } from \"../plugin-utils/logging\";\nimport type {\n ExecutionContext,\n InferOverridableConfig,\n PluginConfig,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { mergeConfigs } from \"./hooks\";\n\nexport function getConfigProps<TResolvedConfig extends ResolvedConfig>(\n config:\n | TResolvedConfig[\"userConfig\"]\n | TResolvedConfig[\"inlineConfig\"]\n | TResolvedConfig[\"pluginConfig\"]\n | InferOverridableConfig<TResolvedConfig> = {}\n) {\n return {\n input: isSetString(config.input) ? [config.input] : config.input,\n ...config\n };\n}\n\nexport async function resolvePluginConfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown,\n TContext extends ExecutionContext<TResolvedConfig, TSystemContext> =\n ExecutionContext<TResolvedConfig, TSystemContext>\n>(context: TContext) {\n const timer = context.timer(\n `${titleCase(context.config.command)} Execution - Initialization`\n );\n\n for (const plugin of (\n context.config.plugins as PluginConfig<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n ).flatMap(p => toArray(p)) ?? []) {\n await context.unstable_addPlugin(plugin);\n }\n\n if (context.plugins.length === 0) {\n context.warn({\n meta: {\n category: \"plugins\"\n },\n message:\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n });\n } else {\n const pluginNumberWidth =\n context.plugins.length >= 10 ? String(context.plugins.length).length : 1;\n\n context.info({\n meta: {\n category: \"plugins\"\n },\n message: `Loaded ${context.plugins.length} ${titleCase(\n context.config.framework?.name ?? \"powerlines\"\n )} plugin${context.plugins.length > 1 ? \"s\" : \"\"}: \\n${context.plugins\n .map(\n (plugin, index) =>\n `${String(index + 1).padStart(\n pluginNumberWidth,\n \"0\"\n )}. ${colorText(plugin.name)}`\n )\n .join(\"\\n\")}`\n });\n }\n\n const pluginConfig = await context.callHook(\"config\", {\n environment: await context.getEnvironment(),\n sequential: true,\n result: \"merge\",\n merge: mergeConfigs\n });\n if (pluginConfig) {\n await context.setPluginConfig(\n pluginConfig as TContext[\"config\"][\"pluginConfig\"]\n );\n } else {\n context.debug({\n meta: {\n category: \"config\"\n },\n message: \"No plugin configuration was returned from the config hook.\"\n });\n }\n\n timer();\n}\n"],"mappings":";;;;;;;AA+BA,SAAgB,eACd,SAI8C,CAAC,GAC/C;CACA,OAAO;EACL,OAAO,YAAY,OAAO,KAAK,IAAI,CAAC,OAAO,KAAK,IAAI,OAAO;EAC3D,GAAG;CACL;AACF;AAEA,eAAsB,oBAKpB,SAAmB;CACnB,MAAM,QAAQ,QAAQ,MACpB,GAAG,UAAU,QAAQ,OAAO,OAAO,EAAE,4BACvC;CAEA,KAAK,MAAM,UACT,QAAQ,OAAO,QAGf,SAAQ,MAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,GAC7B,MAAM,QAAQ,mBAAmB,MAAM;CAGzC,IAAI,QAAQ,QAAQ,WAAW,GAC7B,QAAQ,KAAK;EACX,MAAM,EACJ,UAAU,UACZ;EACA,SACE;CACJ,CAAC;MACI;EACL,MAAM,oBACJ,QAAQ,QAAQ,UAAU,KAAK,OAAO,QAAQ,QAAQ,MAAM,EAAE,SAAS;EAEzE,QAAQ,KAAK;GACX,MAAM,EACJ,UAAU,UACZ;GACA,SAAS,UAAU,QAAQ,QAAQ,OAAO,GAAG,UAC3C,QAAQ,OAAO,WAAW,QAAQ,YACpC,EAAE,SAAS,QAAQ,QAAQ,SAAS,IAAI,MAAM,GAAG,MAAM,QAAQ,QAC5D,KACE,QAAQ,UACP,GAAG,OAAO,QAAQ,CAAC,EAAE,SACnB,mBACA,GACF,EAAE,IAAI,UAAU,OAAO,IAAI,GAC/B,EACC,KAAK,IAAI;EACd,CAAC;CACH;CAEA,MAAM,eAAe,MAAM,QAAQ,SAAS,UAAU;EACpD,aAAa,MAAM,QAAQ,eAAe;EAC1C,YAAY;EACZ,QAAQ;EACR,OAAO;CACT,CAAC;CACD,IAAI,cACF,MAAM,QAAQ,gBACZ,YACF;MAEA,QAAQ,MAAM;EACZ,MAAM,EACJ,UAAU,SACZ;EACA,SAAS;CACX,CAAC;CAGH,MAAM;AACR"}
@@ -53,7 +53,9 @@ function mergeConfigs(currentResult, previousResults) {
53
53
  async function _callHook(context, key, options, ...args) {
54
54
  const hooks = context.selectHooks(key, options);
55
55
  if (hooks.length > 0) {
56
- context.extendLogger({ category: "hooks" }).debug(`🧩 Calling ${hooks.length} ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => ` ${index + 1}. ${require_plugin_utils_logging.colorText(hook.plugin.name)}`).join("\n")}`);
56
+ const logger = context.extendLogger({ category: "hooks" });
57
+ const pluginNumberWidth = hooks.length >= 10 ? String(hooks.length).length : 1;
58
+ logger.debug(`🧩 Calling ${hooks.length} ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => `${String(index + 1).padStart(pluginNumberWidth, "0")}. ${require_plugin_utils_logging.colorText(hook.plugin.name)}`).join("\n")}`);
57
59
  const invokeHook = async (hook, hookArgs) => {
58
60
  return Reflect.apply(hook.handler, hook.context, hookArgs);
59
61
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.cts","names":[],"sources":["../../src/lib/hooks.ts"],"mappings":";;;;;;;;;;;;iBA0DgB,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  async function _callHook(context, key, options, ...args) {
51
51
  const hooks = context.selectHooks(key, options);
52
52
  if (hooks.length > 0) {
53
- context.extendLogger({ category: "hooks" }).debug(`🧩 Calling ${hooks.length} ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => ` ${index + 1}. ${colorText(hook.plugin.name)}`).join("\n")}`);
53
+ const logger = context.extendLogger({ category: "hooks" });
54
+ const pluginNumberWidth = hooks.length >= 10 ? String(hooks.length).length : 1;
55
+ logger.debug(`🧩 Calling ${hooks.length} ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)} plugin hook${hooks.length > 1 ? "s" : ""}:\n${hooks.map((hook, index) => `${String(index + 1).padStart(pluginNumberWidth, "0")}. ${colorText(hook.plugin.name)}`).join("\n")}`);
54
56
  const invokeHook = async (hook, hookArgs) => {
55
57
  return Reflect.apply(hook.handler, hook.context, hookArgs);
56
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.mjs","names":["defu"],"sources":["../../src/lib/hooks.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 { getField } from \"@stryke/helpers/get-field\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport {\n addPluginHook,\n colorText,\n isPluginHook,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n CallHookOptions,\n EnvironmentContext,\n ExecutionContext,\n HookListOrders,\n HooksList,\n HooksListItem,\n InferHookParameters,\n InferHookReturnType,\n Plugin,\n PluginContext,\n PluginHookFields,\n ResolvedConfig\n} from \"../types\";\n\n/**\n * Merges the current hook result with the previous results based on their types.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\nexport function mergeResults<\n T extends Record<string | number | symbol, any> | string\n>(currentResult: T, previousResults: T[]): T[] {\n if (!previousResults || previousResults.length === 0) {\n return [currentResult];\n }\n\n if (isSetString(currentResult)) {\n previousResults = [\n `${isSetString(previousResults[0]) ? previousResults[0] || \"\" : \"\"}\\n${\n isSetString(previousResults[0])\n ? currentResult.replace(previousResults[0], \"\")\n : currentResult\n }`.trim() as T\n ];\n } else if (isObject(currentResult)) {\n previousResults =\n previousResults.length > 0\n ? [defu(currentResult, previousResults[0])]\n : [currentResult];\n }\n\n return previousResults;\n}\n\n/**\n * Merges multiple hook results together, with special handling for string values and object values.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\nexport function mergeConfigs<T>(currentResult: T, previousResults: T): T {\n if (isString(currentResult)) {\n previousResults =\n `${isString(previousResults) ? previousResults || \"\" : \"\"}\\n${\n currentResult || \"\"\n }`.trim() as T;\n } else if (isObject(currentResult)) {\n previousResults = mergeConfig(currentResult, previousResults ?? {}) as T;\n }\n\n return previousResults;\n}\n\n/**\n * Calls a hook with the given context, options, and arguments.\n *\n * @param context - The context to use when calling the hook.\n * @param key - The hook to call.\n * @param options - Options for calling the hook.\n * @param args - Arguments to pass to the hook.\n * @returns The return value of the hook.\n */\nasync function _callHook<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TKey extends string\n>(\n context: EnvironmentContext<TResolvedConfig, TSystemContext>,\n key: TKey,\n options: CallHookOptions,\n ...args: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n): Promise<\n | InferHookReturnType<PluginContext<TResolvedConfig, TSystemContext>, TKey>\n | undefined\n> {\n const hooks = context.selectHooks(key, options);\n if (hooks.length > 0) {\n const logger = context.extendLogger({ category: \"hooks\" });\n\n logger.debug(\n `🧩 Calling ${hooks.length} ${chalk.bold.cyanBright(\n `${key}${options?.order ? ` (${options.order})` : \"\"}`\n )} plugin hook${hooks.length > 1 ? \"s\" : \"\"}:\\n${hooks\n .map((hook, index) => ` ${index + 1}. ${colorText(hook.plugin.name)}`)\n .join(\"\\n\")}`\n );\n\n const invokeHook = async (\n hook: ArrayValues<typeof hooks>,\n hookArgs: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n ) => {\n return Reflect.apply(hook.handler as AnyFunction, hook.context, hookArgs);\n };\n\n let results = [] as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[];\n if (options?.sequential === false) {\n results = (await Promise.all(\n hooks.map(async hook => {\n if (!isFunction(hook.handler)) {\n throw new Error(\n `Plugin hook handler for hook \"${key}\" is not a function.`\n );\n }\n\n return invokeHook(hook, [...args]);\n })\n )) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[];\n } else {\n for (const hook of hooks) {\n if (!isFunction(hook.handler)) {\n throw new Error(\n `Plugin hook handler for hook \"${key}\" is not a function.`\n );\n }\n\n if (options?.result === \"first\" || options?.asNextParam === false) {\n results.push(\n (await Promise.resolve(\n invokeHook(hook, [...args])\n )) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n );\n if (\n options?.result === \"first\" &&\n isSet(results[results.length - 1])\n ) {\n break;\n }\n } else {\n const sequenceArgs = [...args];\n if (results.length > 0 && sequenceArgs.length > 0) {\n sequenceArgs[0] = isFunction(options.asNextParam)\n ? await Promise.resolve(options.asNextParam(results[0]))\n : results[0];\n }\n\n const result = await Promise.resolve(\n invokeHook(hook, [...sequenceArgs] as InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >)\n );\n if (result) {\n if (options.result === \"last\") {\n results = [result];\n } else if (options.result === \"merge\" && options.merge) {\n results = [\n results.length > 0 && results[0]\n ? await Promise.resolve(options.merge(result, results[0]))\n : result\n ];\n } else {\n results = mergeResults(result, results);\n }\n }\n }\n }\n }\n\n const definedResults = results.filter(\n (\n result\n ): result is NonNullable<\n InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n > => isSet(result)\n );\n\n if (definedResults.length > 0) {\n let mergedResult = undefined as\n | InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n | undefined;\n\n for (const result of definedResults) {\n mergedResult = defu(\n result as Record<string, unknown>,\n mergedResult ?? {}\n ) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n }\n\n return mergedResult;\n }\n }\n\n return undefined;\n}\n\nexport function extractHooks<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n context: PluginContext<TResolvedConfig, TSystemContext>,\n hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >,\n plugin: Plugin<PluginContext<TResolvedConfig, TSystemContext>>,\n key: string,\n parentKey?: string\n): Record<string, HooksList<PluginContext<TResolvedConfig, TSystemContext>>> {\n const combinedKey = parentKey ? `${parentKey}:${key}` : key;\n const pluginField = getField(plugin, combinedKey.replace(/:/g, \".\"));\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(\n combinedKey\n ) &&\n isPluginHook(pluginField)\n ) {\n const pluginHook = pluginField;\n if (!isPluginHook(pluginHook)) {\n return hooks;\n }\n\n hooks[combinedKey] ??= {\n preEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n preOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n normal: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n };\n\n if (plugin.enforce) {\n const hookListOrder = `${plugin.enforce}Enforced` as HookListOrders;\n hooks[combinedKey][hookListOrder] ??= [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[];\n\n hooks[combinedKey][hookListOrder] = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);\n\n return hooks;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n hooks[combinedKey].normal ??= [];\n\n hooks[combinedKey].normal = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey].normal);\n\n return hooks;\n }\n\n const hookListOrder = `${pluginHook.order}Ordered` as HookListOrders;\n hooks[combinedKey][hookListOrder] ??= [];\n\n hooks[combinedKey][hookListOrder] = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);\n\n return hooks;\n } else if (isSetObject(pluginField)) {\n return Object.keys(pluginField)\n .map(pluginKey =>\n extractHooks(context, hooks, plugin, pluginKey, combinedKey)\n )\n .reduce((ret, current) => {\n Object.keys(current).forEach(key => {\n ret[key] ??= {\n preEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n preOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n normal: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n };\n\n [\n \"preEnforced\",\n \"preOrdered\",\n \"normal\",\n \"postEnforced\",\n \"postOrdered\"\n ].forEach(order => {\n if (\n current[key]?.[\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]\n ) {\n ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ] ??= [];\n ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ] = ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]!.concat(\n current[key][\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]!\n );\n }\n });\n });\n\n return ret;\n }, hooks);\n }\n\n return hooks;\n}\n\nexport async function callHook<\n TKey extends string,\n TResolvedConfig extends ResolvedConfig,\n TSystemContext = unknown\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n key: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig, TSystemContext>;\n },\n ...args: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n) {\n return _callHook<TResolvedConfig, TSystemContext, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await context.getEnvironment(options?.environment),\n key,\n { sequential: true, ...options },\n ...args\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,aAEd,eAAkB,iBAA2B;CAC7C,IAAI,CAAC,mBAAmB,gBAAgB,WAAW,GACjD,OAAO,CAAC,aAAa;CAGvB,IAAI,YAAY,aAA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IAAI,KACF,WAGI,CAAC;KACP,IAAI,KACF,SAGE,IAAI,KACN,OAGC,OACD,QAAQ,KACN,MAIJ;IACF;GACF,CAAC;EACH,CAAC;EAED,OAAO;CACT,GAAG,KAAK;CAGZ,OAAO;AACT;AAEA,eAAsB,SAKpB,SACA,KACA,SAGA,GAAG,MAIH;CACA,OAAO,UACL,YAAY,SAAS,WAAW,IAC5B,QAAQ,cACR,MAAM,QAAQ,eAAe,SAAS,WAAW,GACrD,KACA;EAAE,YAAY;EAAM,GAAG;CAAQ,GAC/B,GAAG,IACL;AACF"}
1
+ {"version":3,"file":"hooks.mjs","names":["defu"],"sources":["../../src/lib/hooks.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 { getField } from \"@stryke/helpers/get-field\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { AnyFunction } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport {\n addPluginHook,\n colorText,\n isPluginHook,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n CallHookOptions,\n EnvironmentContext,\n ExecutionContext,\n HookListOrders,\n HooksList,\n HooksListItem,\n InferHookParameters,\n InferHookReturnType,\n Plugin,\n PluginContext,\n PluginHookFields,\n ResolvedConfig\n} from \"../types\";\n\n/**\n * Merges the current hook result with the previous results based on their types.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\nexport function mergeResults<\n T extends Record<string | number | symbol, any> | string\n>(currentResult: T, previousResults: T[]): T[] {\n if (!previousResults || previousResults.length === 0) {\n return [currentResult];\n }\n\n if (isSetString(currentResult)) {\n previousResults = [\n `${isSetString(previousResults[0]) ? previousResults[0] || \"\" : \"\"}\\n${\n isSetString(previousResults[0])\n ? currentResult.replace(previousResults[0], \"\")\n : currentResult\n }`.trim() as T\n ];\n } else if (isObject(currentResult)) {\n previousResults =\n previousResults.length > 0\n ? [defu(currentResult, previousResults[0])]\n : [currentResult];\n }\n\n return previousResults;\n}\n\n/**\n * Merges multiple hook results together, with special handling for string values and object values.\n *\n * @param currentResult - The current hook result to merge with the previous results.\n * @param previousResults - The previous hook results to merge with the current result.\n * @returns The merged result.\n */\nexport function mergeConfigs<T>(currentResult: T, previousResults: T): T {\n if (isString(currentResult)) {\n previousResults =\n `${isString(previousResults) ? previousResults || \"\" : \"\"}\\n${\n currentResult || \"\"\n }`.trim() as T;\n } else if (isObject(currentResult)) {\n previousResults = mergeConfig(currentResult, previousResults ?? {}) as T;\n }\n\n return previousResults;\n}\n\n/**\n * Calls a hook with the given context, options, and arguments.\n *\n * @param context - The context to use when calling the hook.\n * @param key - The hook to call.\n * @param options - Options for calling the hook.\n * @param args - Arguments to pass to the hook.\n * @returns The return value of the hook.\n */\nasync function _callHook<\n TResolvedConfig extends ResolvedConfig,\n TSystemContext,\n TKey extends string\n>(\n context: EnvironmentContext<TResolvedConfig, TSystemContext>,\n key: TKey,\n options: CallHookOptions,\n ...args: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n): Promise<\n | InferHookReturnType<PluginContext<TResolvedConfig, TSystemContext>, TKey>\n | undefined\n> {\n const hooks = context.selectHooks(key, options);\n if (hooks.length > 0) {\n const logger = context.extendLogger({ category: \"hooks\" });\n const pluginNumberWidth =\n hooks.length >= 10 ? String(hooks.length).length : 1;\n\n logger.debug(\n `🧩 Calling ${hooks.length} ${chalk.bold.cyanBright(\n `${key}${options?.order ? ` (${options.order})` : \"\"}`\n )} plugin hook${hooks.length > 1 ? \"s\" : \"\"}:\\n${hooks\n .map(\n (hook, index) =>\n `${String(index + 1).padStart(\n pluginNumberWidth,\n \"0\"\n )}. ${colorText(hook.plugin.name)}`\n )\n .join(\"\\n\")}`\n );\n\n const invokeHook = async (\n hook: ArrayValues<typeof hooks>,\n hookArgs: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n ) => {\n return Reflect.apply(hook.handler as AnyFunction, hook.context, hookArgs);\n };\n\n let results = [] as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[];\n if (options?.sequential === false) {\n results = (await Promise.all(\n hooks.map(async hook => {\n if (!isFunction(hook.handler)) {\n throw new Error(\n `Plugin hook handler for hook \"${key}\" is not a function.`\n );\n }\n\n return invokeHook(hook, [...args]);\n })\n )) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[];\n } else {\n for (const hook of hooks) {\n if (!isFunction(hook.handler)) {\n throw new Error(\n `Plugin hook handler for hook \"${key}\" is not a function.`\n );\n }\n\n if (options?.result === \"first\" || options?.asNextParam === false) {\n results.push(\n (await Promise.resolve(\n invokeHook(hook, [...args])\n )) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n );\n if (\n options?.result === \"first\" &&\n isSet(results[results.length - 1])\n ) {\n break;\n }\n } else {\n const sequenceArgs = [...args];\n if (results.length > 0 && sequenceArgs.length > 0) {\n sequenceArgs[0] = isFunction(options.asNextParam)\n ? await Promise.resolve(options.asNextParam(results[0]))\n : results[0];\n }\n\n const result = await Promise.resolve(\n invokeHook(hook, [...sequenceArgs] as InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >)\n );\n if (result) {\n if (options.result === \"last\") {\n results = [result];\n } else if (options.result === \"merge\" && options.merge) {\n results = [\n results.length > 0 && results[0]\n ? await Promise.resolve(options.merge(result, results[0]))\n : result\n ];\n } else {\n results = mergeResults(result, results);\n }\n }\n }\n }\n }\n\n const definedResults = results.filter(\n (\n result\n ): result is NonNullable<\n InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n > => isSet(result)\n );\n\n if (definedResults.length > 0) {\n let mergedResult = undefined as\n | InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n | undefined;\n\n for (const result of definedResults) {\n mergedResult = defu(\n result as Record<string, unknown>,\n mergedResult ?? {}\n ) as InferHookReturnType<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n }\n\n return mergedResult;\n }\n }\n\n return undefined;\n}\n\nexport function extractHooks<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>(\n context: PluginContext<TResolvedConfig, TSystemContext>,\n hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >,\n plugin: Plugin<PluginContext<TResolvedConfig, TSystemContext>>,\n key: string,\n parentKey?: string\n): Record<string, HooksList<PluginContext<TResolvedConfig, TSystemContext>>> {\n const combinedKey = parentKey ? `${parentKey}:${key}` : key;\n const pluginField = getField(plugin, combinedKey.replace(/:/g, \".\"));\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(\n combinedKey\n ) &&\n isPluginHook(pluginField)\n ) {\n const pluginHook = pluginField;\n if (!isPluginHook(pluginHook)) {\n return hooks;\n }\n\n hooks[combinedKey] ??= {\n preEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n preOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n normal: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n };\n\n if (plugin.enforce) {\n const hookListOrder = `${plugin.enforce}Enforced` as HookListOrders;\n hooks[combinedKey][hookListOrder] ??= [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[];\n\n hooks[combinedKey][hookListOrder] = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);\n\n return hooks;\n }\n\n if (isFunction(pluginHook) || !pluginHook.order) {\n hooks[combinedKey].normal ??= [];\n\n hooks[combinedKey].normal = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey].normal);\n\n return hooks;\n }\n\n const hookListOrder = `${pluginHook.order}Ordered` as HookListOrders;\n hooks[combinedKey][hookListOrder] ??= [];\n\n hooks[combinedKey][hookListOrder] = addPluginHook<\n PluginContext<TResolvedConfig, TSystemContext>,\n PluginHookFields<PluginContext<TResolvedConfig, TSystemContext>>\n >(context, plugin, pluginHook, hooks[combinedKey][hookListOrder]);\n\n return hooks;\n } else if (isSetObject(pluginField)) {\n return Object.keys(pluginField)\n .map(pluginKey =>\n extractHooks(context, hooks, plugin, pluginKey, combinedKey)\n )\n .reduce((ret, current) => {\n Object.keys(current).forEach(key => {\n ret[key] ??= {\n preEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n preOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n normal: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postEnforced: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[],\n postOrdered: [] as HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>\n >[]\n };\n\n [\n \"preEnforced\",\n \"preOrdered\",\n \"normal\",\n \"postEnforced\",\n \"postOrdered\"\n ].forEach(order => {\n if (\n current[key]?.[\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]\n ) {\n ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ] ??= [];\n ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ] = ret[key]![\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]!.concat(\n current[key][\n order as keyof HooksList<\n PluginContext<TResolvedConfig, TSystemContext>\n >\n ]!\n );\n }\n });\n });\n\n return ret;\n }, hooks);\n }\n\n return hooks;\n}\n\nexport async function callHook<\n TKey extends string,\n TResolvedConfig extends ResolvedConfig,\n TSystemContext = unknown\n>(\n context: ExecutionContext<TResolvedConfig, TSystemContext>,\n key: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig, TSystemContext>;\n },\n ...args: InferHookParameters<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >\n) {\n return _callHook<TResolvedConfig, TSystemContext, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await context.getEnvironment(options?.environment),\n key,\n { sequential: true, ...options },\n ...args\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,aAEd,eAAkB,iBAA2B;CAC7C,IAAI,CAAC,mBAAmB,gBAAgB,WAAW,GACjD,OAAO,CAAC,aAAa;CAGvB,IAAI,YAAY,aAAa,GAC3B,kBAAkB,CAChB,GAAG,YAAY,gBAAgB,EAAE,IAAI,gBAAgB,MAAM,KAAK,GAAG,IACjE,YAAY,gBAAgB,EAAE,IAC1B,cAAc,QAAQ,gBAAgB,IAAI,EAAE,IAC5C,gBACH,KAAK,CACV;MACK,IAAI,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,MAIJ;IACF;GACF,CAAC;EACH,CAAC;EAED,OAAO;CACT,GAAG,KAAK;CAGZ,OAAO;AACT;AAEA,eAAsB,SAKpB,SACA,KACA,SAGA,GAAG,MAIH;CACA,OAAO,UACL,YAAY,SAAS,WAAW,IAC5B,QAAQ,cACR,MAAM,QAAQ,eAAe,SAAS,WAAW,GACrD,KACA;EAAE,YAAY;EAAM,GAAG;CAAQ,GAC/B,GAAG,IACL;AACF"}
@@ -59,7 +59,7 @@ async function getWorkspaceName(context) {
59
59
  * Format an execution ID based on the project name, command, and config index.
60
60
  *
61
61
  * @remarks
62
- * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:
62
+ * The execution ID is formatted as `${projectName}:${command}:${index}`, where:
63
63
  * - `projectName` is the name of the project.
64
64
  * - `command` is the command being executed.
65
65
  * - `index` is a zero-padded number representing the execution index (starting from 1).
@@ -67,10 +67,10 @@ async function getWorkspaceName(context) {
67
67
  * @example
68
68
  * ```ts
69
69
  * const executionId = formatExecutionId("my-project", "build", 0);
70
- * // This will return "my-project-build-01"
70
+ * // This will return "my-project:build:01"
71
71
  *
72
72
  * const executionId2 = formatExecutionId("my-project", "test", 5);
73
- * // This will return "my-project-test-06"
73
+ * // This will return "my-project:test:06"
74
74
  * ```
75
75
  *
76
76
  * @param projectName - The name of the project.
@@ -79,7 +79,7 @@ async function getWorkspaceName(context) {
79
79
  * @returns The formatted execution ID.
80
80
  */
81
81
  function formatExecutionId(projectName, command, configIndex = 0) {
82
- return `${projectName}-${command}-${String(configIndex + 1).padStart(2, "0")}`;
82
+ return `${projectName}:${command}:${String(configIndex + 1).padStart(2, "0")}`;
83
83
  }
84
84
 
85
85
  //#endregion
@@ -27,7 +27,7 @@ declare function getWorkspaceName(context: UnresolvedContext): Promise<string |
27
27
  * Format an execution ID based on the project name, command, and config index.
28
28
  *
29
29
  * @remarks
30
- * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:
30
+ * The execution ID is formatted as `${projectName}:${command}:${index}`, where:
31
31
  * - `projectName` is the name of the project.
32
32
  * - `command` is the command being executed.
33
33
  * - `index` is a zero-padded number representing the execution index (starting from 1).
@@ -35,10 +35,10 @@ declare function getWorkspaceName(context: UnresolvedContext): Promise<string |
35
35
  * @example
36
36
  * ```ts
37
37
  * const executionId = formatExecutionId("my-project", "build", 0);
38
- * // This will return "my-project-build-01"
38
+ * // This will return "my-project:build:01"
39
39
  *
40
40
  * const executionId2 = formatExecutionId("my-project", "test", 5);
41
- * // This will return "my-project-test-06"
41
+ * // This will return "my-project:test:06"
42
42
  * ```
43
43
  *
44
44
  * @param projectName - The name of the project.
@@ -27,7 +27,7 @@ declare function getWorkspaceName(context: UnresolvedContext): Promise<string |
27
27
  * Format an execution ID based on the project name, command, and config index.
28
28
  *
29
29
  * @remarks
30
- * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:
30
+ * The execution ID is formatted as `${projectName}:${command}:${index}`, where:
31
31
  * - `projectName` is the name of the project.
32
32
  * - `command` is the command being executed.
33
33
  * - `index` is a zero-padded number representing the execution index (starting from 1).
@@ -35,10 +35,10 @@ declare function getWorkspaceName(context: UnresolvedContext): Promise<string |
35
35
  * @example
36
36
  * ```ts
37
37
  * const executionId = formatExecutionId("my-project", "build", 0);
38
- * // This will return "my-project-build-01"
38
+ * // This will return "my-project:build:01"
39
39
  *
40
40
  * const executionId2 = formatExecutionId("my-project", "test", 5);
41
- * // This will return "my-project-test-06"
41
+ * // This will return "my-project:test:06"
42
42
  * ```
43
43
  *
44
44
  * @param projectName - The name of the project.
@@ -58,7 +58,7 @@ async function getWorkspaceName(context) {
58
58
  * Format an execution ID based on the project name, command, and config index.
59
59
  *
60
60
  * @remarks
61
- * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:
61
+ * The execution ID is formatted as `${projectName}:${command}:${index}`, where:
62
62
  * - `projectName` is the name of the project.
63
63
  * - `command` is the command being executed.
64
64
  * - `index` is a zero-padded number representing the execution index (starting from 1).
@@ -66,10 +66,10 @@ async function getWorkspaceName(context) {
66
66
  * @example
67
67
  * ```ts
68
68
  * const executionId = formatExecutionId("my-project", "build", 0);
69
- * // This will return "my-project-build-01"
69
+ * // This will return "my-project:build:01"
70
70
  *
71
71
  * const executionId2 = formatExecutionId("my-project", "test", 5);
72
- * // This will return "my-project-test-06"
72
+ * // This will return "my-project:test:06"
73
73
  * ```
74
74
  *
75
75
  * @param projectName - The name of the project.
@@ -78,7 +78,7 @@ async function getWorkspaceName(context) {
78
78
  * @returns The formatted execution ID.
79
79
  */
80
80
  function formatExecutionId(projectName, command, configIndex = 0) {
81
- return `${projectName}-${command}-${String(configIndex + 1).padStart(2, "0")}`;
81
+ return `${projectName}:${command}:${String(configIndex + 1).padStart(2, "0")}`;
82
82
  }
83
83
 
84
84
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"context-helpers.mjs","names":[],"sources":["../../src/plugin-utils/context-helpers.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 { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getOrganizationName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n if (isSetString(context.config.organization)) {\n return context.config.organization;\n }\n\n return (\n getPackageJsonOrganization(context.packageJson) ||\n (await getWorkspaceName(context)) ||\n context.config.name\n );\n}\n\n/**\n * Get the organization name from the `package.json` file\n *\n * @param packageJson - The `package.json` object to extract the organization name from.\n * @returns The organization name or undefined if not found.\n */\nexport function getPackageJsonOrganization(\n packageJson: PackageJson\n): string | undefined {\n let result: string | undefined;\n if (\n Array.isArray(packageJson.maintainers) &&\n packageJson.maintainers.length > 0\n ) {\n if (isSetObject(packageJson.maintainers[0])) {\n result = (packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.maintainers[0])) {\n result = packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.author) &&\n packageJson.author.length > 0\n ) {\n if (isSetObject(packageJson.author[0])) {\n result = (packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.author[0])) {\n result = packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.contributors) &&\n packageJson.contributors.length > 0\n ) {\n if (isSetObject(packageJson.contributors[0])) {\n result = (packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.contributors[0])) {\n result = packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(packageJson.namespace)) {\n result = packageJson.namespace?.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(packageJson.name)) {\n result = packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getWorkspaceName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n let result: string | undefined;\n\n const workspaceConfig = await tryGetWorkspaceConfig(true);\n if (workspaceConfig) {\n if (isSetString(workspaceConfig.name)) {\n result = workspaceConfig.name;\n }\n\n if (!result && isSetString(workspaceConfig.namespace)) {\n result = workspaceConfig.namespace.replace(/^@/, \"\");\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Format an execution ID based on the project name, command, and config index.\n *\n * @remarks\n * The execution ID is formatted as `${projectName}-${command}-#${index}`, where:\n * - `projectName` is the name of the project.\n * - `command` is the command being executed.\n * - `index` is a zero-padded number representing the execution index (starting from 1).\n *\n * @example\n * ```ts\n * const executionId = formatExecutionId(\"my-project\", \"build\", 0);\n * // This will return \"my-project-build-01\"\n *\n * const executionId2 = formatExecutionId(\"my-project\", \"test\", 5);\n * // This will return \"my-project-test-06\"\n * ```\n *\n * @param projectName - The name of the project.\n * @param command - The command being executed.\n * @param configIndex - The index of the execution (starting from 0).\n * @returns The formatted execution ID.\n */\nexport function formatExecutionId(\n projectName: string,\n command: string,\n configIndex: number = 0\n) {\n return `${projectName}-${command}-${String(configIndex + 1).padStart(2, \"0\")}`;\n}\n"],"mappings":";;;;;;;;;;;AA8BA,eAAsB,oBACpB,SAC6B;CAC7B,IAAI,YAAY,QAAQ,OAAO,YAAY,GACzC,OAAO,QAAQ,OAAO;CAGxB,OACE,2BAA2B,QAAQ,WAAW,KAC7C,MAAM,iBAAiB,OAAO,KAC/B,QAAQ,OAAO;AAEnB;;;;;;;AAQA,SAAgB,2BACd,aACoB;CACpB,IAAI;CACJ,IACE,MAAM,QAAQ,YAAY,WAAW,KACrC,YAAY,YAAY,SAAS,GACjC;EACA,IAAI,YAAY,YAAY,YAAY,EAAE,GACxC,SAAU,YAAY,YAAY,GAAwB;EAG5D,IAAI,CAAC,UAAU,YAAY,YAAY,YAAY,EAAE,GACnD,SAAS,YAAY,YAAY;CAErC;CAEA,IACE,CAAC,UACD,MAAM,QAAQ,YAAY,MAAM,KAChC,YAAY,OAAO,SAAS,GAC5B;EACA,IAAI,YAAY,YAAY,OAAO,EAAE,GACnC,SAAU,YAAY,OAAO,GAAwB;EAGvD,IAAI,CA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-helpers.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 { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getOrganizationName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n if (isSetString(context.config.organization)) {\n return context.config.organization;\n }\n\n return (\n getPackageJsonOrganization(context.packageJson) ||\n (await getWorkspaceName(context)) ||\n context.config.name\n );\n}\n\n/**\n * Get the organization name from the `package.json` file\n *\n * @param packageJson - The `package.json` object to extract the organization name from.\n * @returns The organization name or undefined if not found.\n */\nexport function getPackageJsonOrganization(\n packageJson: PackageJson\n): string | undefined {\n let result: string | undefined;\n if (\n Array.isArray(packageJson.maintainers) &&\n packageJson.maintainers.length > 0\n ) {\n if (isSetObject(packageJson.maintainers[0])) {\n result = (packageJson.maintainers[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.maintainers[0])) {\n result = packageJson.maintainers[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.author) &&\n packageJson.author.length > 0\n ) {\n if (isSetObject(packageJson.author[0])) {\n result = (packageJson.author[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.author[0])) {\n result = packageJson.author[0];\n }\n }\n\n if (\n !result &&\n Array.isArray(packageJson.contributors) &&\n packageJson.contributors.length > 0\n ) {\n if (isSetObject(packageJson.contributors[0])) {\n result = (packageJson.contributors[0] as { name: string }).name;\n }\n\n if (!result && isSetString(packageJson.contributors[0])) {\n result = packageJson.contributors[0];\n }\n }\n\n if (!result && isSetString(packageJson.namespace)) {\n result = packageJson.namespace?.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(packageJson.name)) {\n result = packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Get the organization name from the context\n *\n * @param context - The Powerlines plugin context.\n * @returns The organization name or undefined if not found.\n */\nexport async function getWorkspaceName(\n context: UnresolvedContext\n): Promise<string | undefined> {\n let result: string | undefined;\n\n const workspaceConfig = await tryGetWorkspaceConfig(true);\n if (workspaceConfig) {\n if (isSetString(workspaceConfig.name)) {\n result = workspaceConfig.name;\n }\n\n if (!result && isSetString(workspaceConfig.namespace)) {\n result = workspaceConfig.namespace.replace(/^@/, \"\");\n }\n }\n\n if (!result && isSetString(context.packageJson.namespace)) {\n result = context.packageJson.namespace.replace(/^@/, \"\");\n }\n\n if (!result && isSetString(context.packageJson.name)) {\n result = context.packageJson.name.replace(/^@/, \"\").replace(/\\/.*$/, \"\");\n }\n\n return result;\n}\n\n/**\n * Format an execution ID based on the project name, command, and config index.\n *\n * @remarks\n * The execution ID is formatted as `${projectName}:${command}:${index}`, where:\n * - `projectName` is the name of the project.\n * - `command` is the command being executed.\n * - `index` is a zero-padded number representing the execution index (starting from 1).\n *\n * @example\n * ```ts\n * const executionId = formatExecutionId(\"my-project\", \"build\", 0);\n * // This will return \"my-project:build:01\"\n *\n * const executionId2 = formatExecutionId(\"my-project\", \"test\", 5);\n * // This will return \"my-project:test:06\"\n * ```\n *\n * @param projectName - The name of the project.\n * @param command - The command being executed.\n * @param configIndex - The index of the execution (starting from 0).\n * @returns The formatted execution ID.\n */\nexport function formatExecutionId(\n projectName: string,\n command: string,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CAC7B,IAAI;CAEJ,MAAM,kBAAkB,MAAM,sBAAsB,IAAI;CACxD,IAAI,iBAAiB;EACnB,IAAI,YAAY,gBAAgB,IAAI,GAClC,SAAS,gBAAgB;EAG3B,IAAI,CAAC,UAAU,YAAY,gBAAgB,SAAS,GAClD,SAAS,gBAAgB,UAAU,QAAQ,MAAM,EAAE;CAEvD;CAEA,IAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,SAAS,GACtD,SAAS,QAAQ,YAAY,UAAU,QAAQ,MAAM,EAAE;CAGzD,IAAI,CAAC,UAAU,YAAY,QAAQ,YAAY,IAAI,GACjD,SAAS,QAAQ,YAAY,KAAK,QAAQ,MAAM,EAAE,EAAE,QAAQ,SAAS,EAAE;CAGzE,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,kBACd,aACA,SACA,cAAsB,GACtB;CACA,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,OAAO,cAAc,CAAC,EAAE,SAAS,GAAG,GAAG;AAC7E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.48.40",
3
+ "version": "0.48.42",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -329,17 +329,17 @@
329
329
  "@rolldown/pluginutils": "1.0.0-rc.18",
330
330
  "@storm-software/config": "^1.137.72",
331
331
  "@storm-software/config-tools": "^1.190.40",
332
- "@stryke/capnp": "^0.12.110",
333
- "@stryke/convert": "^0.7.14",
334
- "@stryke/env": "^0.20.101",
335
- "@stryke/fs": "^0.33.84",
336
- "@stryke/hash": "^0.13.37",
337
- "@stryke/helpers": "^0.10.23",
338
- "@stryke/json": "^0.15.7",
339
- "@stryke/path": "^0.29.10",
340
- "@stryke/string-format": "^0.17.25",
341
- "@stryke/type-checks": "^0.6.16",
342
- "@stryke/unique-id": "^0.3.95",
332
+ "@stryke/capnp": "^0.12.111",
333
+ "@stryke/convert": "^0.7.15",
334
+ "@stryke/env": "^0.20.102",
335
+ "@stryke/fs": "^0.33.85",
336
+ "@stryke/hash": "^0.13.38",
337
+ "@stryke/helpers": "^0.10.24",
338
+ "@stryke/json": "^0.15.8",
339
+ "@stryke/path": "^0.29.11",
340
+ "@stryke/string-format": "^0.17.26",
341
+ "@stryke/type-checks": "^0.6.17",
342
+ "@stryke/unique-id": "^0.3.96",
343
343
  "birpc": "^4.0.0",
344
344
  "bundle-require": "^5.1.0",
345
345
  "c12": "^3.3.4",
@@ -363,7 +363,7 @@
363
363
  },
364
364
  "devDependencies": {
365
365
  "@storm-software/testing-tools": "^1.119.193",
366
- "@stryke/types": "^0.12.11",
366
+ "@stryke/types": "^0.12.12",
367
367
  "@types/bun": "^1.3.14",
368
368
  "@types/diff-match-patch": "^1.0.36",
369
369
  "@types/node": "^25.9.1",
@@ -375,5 +375,5 @@
375
375
  "undici-types": "^7.27.0"
376
376
  },
377
377
  "publishConfig": { "access": "public" },
378
- "gitHead": "99318f19038da403a1aad83c23d5b47e88dac17c"
378
+ "gitHead": "c7982ab72dab413b5515c548d84f5bd39240abe5"
379
379
  }