powerlines 0.42.38 → 0.42.39

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.
@@ -41,7 +41,7 @@ import { StormJSON } from "@stryke/json/storm-json";
41
41
 
42
42
  //#region package.json
43
43
  var name = "powerlines";
44
- var version = "0.42.38";
44
+ var version = "0.42.39";
45
45
 
46
46
  //#endregion
47
47
  //#region src/_internal/helpers/generate-types.ts
@@ -1075,4 +1075,4 @@ ${formatTypes(code)}
1075
1075
 
1076
1076
  //#endregion
1077
1077
  export { name as n, version as r, PowerlinesAPI as t };
1078
- //# sourceMappingURL=api-BrPeHPR6.mjs.map
1078
+ //# sourceMappingURL=api-ObH5-iUb.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-BrPeHPR6.mjs","names":["#context","#addPlugin","packageJson.version","#executeEnvironments","defu","#types","#handleBuild","#getEnvironments","#initPlugin","#resolvePlugin","isPlugin","isPluginConfig"],"sources":["../package.json","../src/_internal/helpers/generate-types.ts","../src/_internal/helpers/install.ts","../src/_internal/helpers/install-dependencies.ts","../src/_internal/helpers/resolve-tsconfig.ts","../src/api.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 { appendPath } from \"@stryke/path/append\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\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 { DiagnosticCategory, Node, Project, SourceFile } from \"ts-morph\";\nimport { Context } from \"../../types\";\nimport { createProgram } from \"../../typescript/ts-morph\";\nimport { format } from \"../../utils\";\n\ninterface ModuleExportSpecifier {\n name: string;\n alias?: string;\n default?: boolean;\n type?: boolean;\n}\n\ninterface ModuleReference {\n name?: string;\n specifiers?: ModuleExportSpecifier[];\n all?: boolean;\n}\n\ninterface ImportModuleReference extends ModuleReference {\n name: string;\n ambient?: boolean;\n}\n\ninterface ExportModuleReference extends ModuleReference {\n text: string;\n fullText: string;\n comment?: string;\n}\n\ninterface ModuleDeclaration {\n name: string;\n text: string;\n sourceFile: SourceFile;\n comment?: string;\n exports: (ExportModuleReference | string)[];\n imports: ImportModuleReference[];\n}\n\nexport interface TypegenContext {\n context: Context;\n emitted: Map<string, string>;\n modules: ModuleDeclaration[];\n}\n\n/**\n * Formats the generated TypeScript types source code.\n *\n * @param code - The generated TypeScript code.\n * @returns The formatted TypeScript code.\n */\nexport function formatTypes(code = \"\"): string {\n return code.replaceAll(\"#private;\", \"\").replace(/__Ω/g, \"\");\n}\n\nasync function extractModuleDeclarations(\n ctx: TypegenContext,\n filePath: string,\n name: string,\n text: string\n): Promise<ModuleDeclaration> {\n const imports: ImportModuleReference[] = [];\n const exports: (ExportModuleReference | string)[] = [];\n\n const comment = text\n .match(\n new RegExp(\n `\\\\/\\\\*\\\\*(?s:.)*?@module\\\\s+${\n ctx.context.config.framework\n }:${name}(?s:.)*?\\\\*\\\\/\\\\s+`\n )\n )\n ?.find(comment => isSetString(comment?.trim()));\n\n // Parse the emitted .d.ts content using an in-memory ts-morph project\n const project = new Project({ useInMemoryFileSystem: true });\n const sourceFile = project.createSourceFile(\"module.d.ts\", text);\n\n // Collect /// <reference types=\"...\" /> directives as ambient dependencies\n for (const ref of sourceFile.getTypeReferenceDirectives()) {\n if (\n ref.getFileName() &&\n !ctx.context.builtins.some(builtin => ref.getFileName().endsWith(builtin))\n ) {\n imports.push({\n name: ref.getFileName(),\n ambient: true\n });\n }\n }\n\n for (const statement of sourceFile.getStatements()) {\n // --- Import declarations ---\n if (Node.isImportDeclaration(statement)) {\n const moduleSpec = statement.getModuleSpecifierValue();\n\n // Namespace import: import * as X from '...'\n if (statement.getNamespaceImport()) {\n imports.push({\n name: moduleSpec,\n specifiers: [\n {\n name: statement.getNamespaceImport()!.getText()\n }\n ],\n all: true\n });\n }\n\n // Named imports: import X from '...' or import { A, B as C } from '...'\n else if (\n statement.getNamedImports().length > 0 ||\n statement.getDefaultImport()\n ) {\n const specifiers: ModuleExportSpecifier[] = [];\n if (statement.getDefaultImport()) {\n specifiers.push({\n name: statement.getDefaultImport()!.getText(),\n default: true,\n type: statement.isTypeOnly()\n });\n }\n\n statement.getNamedImports().forEach(named => {\n specifiers.push({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n });\n });\n\n imports.push({\n name: moduleSpec,\n specifiers\n });\n }\n }\n\n // --- Export declarations ---\n else if (Node.isExportDeclaration(statement)) {\n const moduleSpec = statement.getModuleSpecifierValue();\n if (moduleSpec) {\n // Resolve the module specifier\n let resolvedSpec = moduleSpec;\n if (!ctx.context.builtins.includes(moduleSpec)) {\n if (ctx.emitted.has(moduleSpec)) {\n resolvedSpec = ctx.emitted.get(moduleSpec)!;\n } else {\n const resolvedModule = await ctx.context.resolve(\n moduleSpec,\n filePath\n );\n if (isSetString(resolvedModule?.id)) {\n resolvedSpec = resolvedModule.id;\n }\n }\n }\n\n // Re-export from another module\n const namedExports = statement.getNamedExports();\n if (namedExports.length > 0) {\n exports.push({\n name: resolvedSpec,\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: namedExports.map(named => ({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n })),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n .trim()\n });\n } else {\n // export * from '...'\n exports.push({\n name: resolvedSpec,\n text: statement.getText(),\n fullText: statement.getFullText(),\n all: true,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n .trim()\n });\n }\n } else {\n const specifiers = statement.getNamedExports().map(named => ({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n }));\n if (specifiers.length > 0) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n }\n }\n\n // --- Export assignments (export default ...) ---\n else if (Node.isExportAssignment(statement)) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Function declarations (export declare function ...) ---\n else if (\n Node.isFunctionDeclaration(statement) &&\n statement.isExported() &&\n statement.getNameNode()\n ) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: [\n {\n name: statement.getNameNode()!.getText()\n }\n ],\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Variable statements (export declare const ...) ---\n else if (Node.isVariableStatement(statement) && statement.isExported()) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: statement\n .getDeclarationList()\n .getDeclarations()\n .filter(\n decl => decl.getNameNode() && Node.isIdentifier(decl.getNameNode())\n )\n .map(decl => ({ name: decl.getNameNode().getText() })),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Class declarations (export declare class ...) ---\n else if (Node.isClassDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Interface declarations (export declare interface ...) ---\n else if (Node.isInterfaceDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Type alias declarations (export declare type ...) ---\n else if (Node.isTypeAliasDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- All other statements (declarations) ---\n else if (\n ctx.context.config.output.sourceMap ||\n !statement.getFullText().includes(\"//# sourceMappingURL=\")\n ) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n }\n\n return {\n name,\n text,\n sourceFile,\n comment,\n imports,\n exports\n };\n}\n\n/**\n * Emits TypeScript declaration types for the provided files using the given TypeScript configuration.\n *\n * @param context - The context containing options and environment paths.\n * @param files - The list of files to generate types for.\n * @returns A promise that resolves to the generated TypeScript declaration types.\n */\nexport async function emitBuiltinTypes<TContext extends Context>(\n context: TContext,\n files: string[]\n): Promise<{ code: string; directives: string[] }> {\n if (files.length === 0) {\n context.debug(\n \"No files provided for TypeScript types generation. Typescript compilation for built-in modules will be skipped.\"\n );\n return { code: \"\", directives: [] };\n }\n\n context.debug(\n `Running the TypeScript compiler for ${\n files.length\n } generated built-in module files.`\n );\n\n const program = createProgram(context, {\n skipAddingFilesFromTsConfig: true,\n compilerOptions: {\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n sourceMap: false,\n outDir: replacePath(\n context.builtinsPath,\n context.workspaceConfig.workspaceRoot\n ),\n composite: false,\n incremental: false,\n tsBuildInfoFile: undefined\n }\n });\n\n program.addSourceFilesAtPaths(files);\n const emitResult = program.emitToMemory({ emitOnlyDtsFiles: true });\n\n const diagnostics = emitResult.getDiagnostics();\n if (diagnostics && diagnostics.length > 0) {\n if (diagnostics.some(d => d.getCategory() === DiagnosticCategory.Error)) {\n throw new Error(\n `The Typescript emit process failed while generating built-in types: \\n ${diagnostics\n .filter(d => d.getCategory() === DiagnosticCategory.Error)\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n } else if (\n diagnostics.some(d => d.getCategory() === DiagnosticCategory.Warning)\n ) {\n context.warn(\n `The Typescript emit process completed with warnings while generating built-in types: \\n ${diagnostics\n .filter(d => d.getCategory() === DiagnosticCategory.Warning)\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n } else {\n context.debug(\n `The Typescript emit process completed with diagnostic messages while generating built-in types: \\n ${diagnostics\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n }\n }\n\n const emittedFiles = emitResult.getFiles();\n context.debug(\n `The TypeScript compiler emitted ${\n emittedFiles.length\n } files for built-in types.`\n );\n\n if (emittedFiles.length === 0) {\n context.warn(\n \"The TypeScript compiler did not emit any files for built-in types. This may indicate an issue with the TypeScript configuration or the provided files.\"\n );\n return { code: \"\", directives: [] };\n }\n\n const ctx = {\n context,\n modules: [] as ModuleDeclaration[],\n emitted: new Map<string, string>()\n };\n\n await Promise.all(\n emittedFiles.map(async emittedFile => {\n const filePath = appendPath(\n emittedFile.filePath,\n context.workspaceConfig.workspaceRoot\n );\n if (\n !filePath.endsWith(\".map\") &&\n findFileName(filePath) !== \"tsconfig.tsbuildinfo\" &&\n isParentPath(filePath, context.builtinsPath)\n ) {\n const moduleName = replaceExtension(\n replacePath(\n replacePath(filePath, context.builtinsPath),\n replacePath(\n context.builtinsPath,\n context.workspaceConfig.workspaceRoot\n )\n ),\n \"\",\n {\n fullExtension: true\n }\n );\n if (context.builtins.includes(moduleName)) {\n ctx.emitted.set(filePath, moduleName);\n ctx.modules.push(\n await extractModuleDeclarations(\n ctx,\n filePath,\n moduleName,\n emittedFile.text\n )\n );\n }\n }\n })\n );\n\n const commonDeclarations = [] as ExportModuleReference[];\n for (const mod of ctx.modules) {\n for (const importRef of mod.imports.filter(importRef =>\n context.builtins.some(builtin => importRef.name.endsWith(`:${builtin}`))\n )) {\n const moduleRef = ctx.modules.find(moduleRef =>\n importRef.name.endsWith(`:${moduleRef.name}`)\n );\n if (moduleRef) {\n let declaration: ExportModuleReference | undefined;\n for (const decl of moduleRef.exports.filter(decl =>\n isSetObject(decl)\n )) {\n const specifiers = decl.specifiers?.filter(specifier =>\n importRef.specifiers?.some(\n s =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n );\n if (specifiers && specifiers.length > 0) {\n importRef.specifiers = importRef.specifiers?.filter(\n s =>\n !specifiers.some(\n specifier =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n );\n if (\n importRef.specifiers &&\n importRef.specifiers.length === 0 &&\n !importRef.all &&\n !importRef.ambient\n ) {\n mod.imports = mod.imports.filter(\n imp => imp.name !== importRef.name\n );\n }\n\n declaration = decl;\n break;\n }\n }\n\n if (declaration) {\n for (const decl of moduleRef.exports.filter(\n decl =>\n isSetObject(decl) &&\n !decl.specifiers?.some(s =>\n declaration?.specifiers?.some(\n specifier =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n )\n )) {\n const exportModuleRef = decl as ExportModuleReference;\n if (\n (exportModuleRef.specifiers?.some(s => s.alias || s.name) ||\n exportModuleRef.name) &&\n new RegExp(\n `(^|\\\\s|\\\\n|\\\\r\\\\n|\\\\(|\\\\)|<|>|{|}|\\\\[|\\\\]|\\\\!|\\\\?|\\\\.|,|\\\\*|&|:)(${\n exportModuleRef.specifiers\n ?.map(s => `${s.alias ? `${s.alias}|` : \"\"}${s.name}`)\n .join(\"|\") || exportModuleRef.name\n })($|\\\\s|\\\\n|\\\\r\\\\n|\\\\(|\\\\)|<|>|{|}|\\\\[|\\\\]|\\\\!|\\\\?|\\\\.|,|\\\\*|&|:|;)`\n ).test(declaration.text)\n ) {\n commonDeclarations.push(exportModuleRef);\n }\n }\n commonDeclarations.push(declaration);\n }\n }\n }\n }\n\n let code = \"\";\n const directives: string[] = [];\n\n for (const commonDeclaration of commonDeclarations) {\n code += formatTypes(\n `${\n commonDeclaration.comment?.trim()\n ? commonDeclaration.comment.trim()\n : \"\"\n }${commonDeclaration.comment?.trim() ? \"\\n\" : \"\"}${formatTypes(\n commonDeclaration.text\n .replace(/\\s*export\\s*/, \"\")\n .replace(/\\s*declare\\s*interface\\s*/, \"interface \")\n .replace(/\\s*declare\\s*type\\s*/, \"type \")\n )}`\n );\n code += \"\\n\\n\";\n }\n\n for (const mod of ctx.modules) {\n code += mod.comment ? `${mod.comment.trim()}\\n` : \"\";\n code += `declare module \"${context.config.framework}:${mod.name}\" { \\n`;\n for (const importRef of mod.imports) {\n if (importRef.ambient) {\n code += directives.push(importRef.name);\n } else if (importRef.all) {\n code += `\\timport * as ${findFileName(importRef.name)} from \"${importRef.name}\";\\n`;\n } else if (importRef.specifiers) {\n const typeOnly = importRef.specifiers.every(s => s.type) ? \" type\" : \"\";\n const specifiers = importRef.specifiers\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \");\n code += `\\timport${typeOnly} { ${specifiers} } from \"${importRef.name}\";\\n`;\n }\n }\n\n if (mod.imports.length > 0) {\n code += \"\\n\";\n }\n\n for (const exportRef of mod.exports.filter(\n e =>\n isString(e) ||\n !e.specifiers ||\n !commonDeclarations.some(\n commonDecl =>\n commonDecl.specifiers &&\n commonDecl.specifiers.some(specifier =>\n e.specifiers?.some(\n s =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n )) {\n if (isSetString(exportRef)) {\n code += `${exportRef}\\n`;\n } else if (exportRef.name) {\n if (exportRef.all) {\n code += `${\n exportRef.comment?.trim() ? exportRef.comment.trim() : \"\"\n }${\n exportRef.comment?.trim() ? \"\\n\" : \"\"\n }export * from \"${exportRef.name}\";\\n`;\n } else if (exportRef.specifiers) {\n if (exportRef.comment?.trim()) {\n code += `${exportRef.comment.trim()}\\n`;\n }\n\n code += `\\texport${\n exportRef.specifiers.every(s => s.type) ? \" type\" : \"\"\n } { ${exportRef.specifiers\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \")} } from \"${exportRef.name}\";\\n`;\n }\n } else {\n code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : \"\"}${\n exportRef.comment?.trim() ? \"\\n\" : \"\"\n }${formatTypes(\n exportRef.text\n .replace(/\\s*export\\s*declare\\s*/, \"export \")\n .replace(/\\s*declare\\s*/, \" \")\n )}\\n`;\n }\n }\n\n mod.exports\n .filter(\n e =>\n !isString(e) &&\n e.specifiers &&\n commonDeclarations.some(\n commonDeclaration =>\n commonDeclaration.specifiers &&\n commonDeclaration.specifiers.some(specifier =>\n e.specifiers?.some(\n s =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n )\n .forEach((e, i, arr) => {\n if (i === 0) {\n code += \"\\nexport { \";\n } else {\n code += \", \";\n }\n\n code += `${\n (e as ExportModuleReference)?.specifiers\n ?.filter(s =>\n commonDeclarations.some(\n commonDeclaration =>\n commonDeclaration.specifiers &&\n commonDeclaration.specifiers.some(\n specifier =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \") || \"\"\n }`;\n\n if (i === arr.length - 1) {\n code += ` };\\n`;\n }\n });\n\n code += \"}\";\n code += \"\\n\\n\";\n }\n\n code = await format(context, context.typesPath, code);\n\n context.debug(\n `A TypeScript declaration file (size: ${prettyBytes(\n new Blob(toArray(code)).size\n )}) emitted for the built-in modules types.`\n );\n\n return { code, directives };\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { install } from \"@stryke/fs/install\";\nimport {\n doesPackageMatch,\n getPackageListing,\n isPackageListed\n} from \"@stryke/fs/package-fns\";\nimport {\n getPackageName,\n getPackageVersion,\n hasPackageVersion\n} from \"@stryke/string-format/package\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport type { Context } from \"../../types\";\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packageName - The name of the package to install\n * @param dev - Whether to install the package as a dev dependency\n */\nexport async function installPackage(\n context: Context,\n packageName: string,\n dev = false\n) {\n if (\n !(await isPackageListed(getPackageName(packageName), {\n cwd: context.config.root\n }))\n ) {\n if (context.config.autoInstall) {\n context.warn(\n `The package \"${packageName}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(packageName, {\n cwd: context.config.root,\n dev\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n throw new Error(\n `An error occurred while installing the package \"${packageName}\"`\n );\n }\n } else {\n context.warn(\n `The package \"${packageName}\" is not installed. Since the \"autoInstall\" option is set to false, it will not be installed automatically.`\n );\n }\n } else if (\n hasPackageVersion(packageName) &&\n !process.env.POWERLINES_SKIP_VERSION_CHECK\n ) {\n const isMatching = await doesPackageMatch(\n getPackageName(packageName),\n getPackageVersion(packageName)!,\n context.config.root\n );\n if (!isMatching) {\n const packageListing = await getPackageListing(\n getPackageName(packageName),\n {\n cwd: context.config.root\n }\n );\n if (\n !packageListing?.version.startsWith(\"catalog:\") &&\n !packageListing?.version.startsWith(\"workspace:\")\n ) {\n context.warn(\n `The package \"${getPackageName(packageName)}\" is installed but does not match the expected version ${getPackageVersion(\n packageName\n )} (installed version: ${packageListing?.version || \"<Unknown>\"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the \"STORM_STACK_SKIP_VERSION_CHECK\" environment variable.`\n );\n }\n }\n }\n}\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packages - The list of packages to install\n */\nexport async function installPackages(\n context: Context,\n packages: Array<{ name: string; dev?: boolean }>\n) {\n return Promise.all(\n packages.map(async pkg => installPackage(context, pkg.name, pkg.dev))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getPackageName } from \"@stryke/string-format/package\";\nimport { Context } from \"../../types\";\nimport { installPackage } from \"./install\";\n\n/**\n * Install missing project dependencies.\n *\n * @param context - The build context.\n */\nexport async function installDependencies<TContext extends Context = Context>(\n context: TContext\n): Promise<void> {\n context.debug(`Checking and installing missing project dependencies.`);\n\n context.dependencies ??= {};\n context.devDependencies ??= {};\n\n if (\n Object.keys(context.dependencies).length === 0 &&\n Object.keys(context.devDependencies).length === 0\n ) {\n context.debug(\n `No dependencies or devDependencies to install. Skipping installation step.`\n );\n return;\n }\n\n context.debug(\n `The following packages are required: \\nDependencies: \\n${Object.entries(\n context.dependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}\\n\\nDevDependencies: \\n${Object.entries(\n context.devDependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}`\n );\n\n await Promise.all([\n Promise.all(\n Object.entries(context.dependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n false\n )\n )\n ),\n Promise.all(\n Object.entries(context.devDependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n true\n )\n )\n )\n ]);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport type { EnvironmentContext } from \"../../types\";\nimport { ResolvedConfig } from \"../../types\";\nimport {\n getParsedTypeScriptConfig,\n getTsconfigFilePath,\n isIncludeMatchFound\n} from \"../../typescript/tsconfig\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.root),\n findFilePath(context.typesPath)\n ),\n findFileName(context.typesPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n context.debug(\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson =\n await resolveTsconfigChanges<TResolvedConfig>(context);\n\n context.debug(\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.warn(\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Unstable_APIContext } from \"@powerlines/core/types/_internal\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger/console\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { copyFiles } from \"@stryke/fs/copy-file\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { install } from \"@stryke/fs/install\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\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 { MaybePromise, PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport defu from \"defu\";\nimport Handlebars from \"handlebars\";\nimport packageJson from \"../package.json\" assert { type: \"json\" };\nimport {\n emitBuiltinTypes,\n formatTypes\n} from \"./_internal/helpers/generate-types\";\nimport { callHook, mergeConfigs } from \"./_internal/helpers/hooks\";\nimport { installDependencies } from \"./_internal/helpers/install-dependencies\";\nimport { writeMetaFile } from \"./_internal/helpers/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"./_internal/helpers/resolve-tsconfig\";\nimport { PowerlinesAPIContext } from \"./context/api-context\";\nimport {\n findInvalidPluginConfig,\n isDuplicate,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"./plugin-utils\";\nimport type {\n API,\n APIContext,\n BuildInlineConfig,\n CallHookOptions,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n EnvironmentContext,\n EnvironmentResolvedConfig,\n InferHookParameters,\n InitialUserConfig,\n LintInlineConfig,\n NewInlineConfig,\n Plugin,\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n PluginContext,\n PluginFactory,\n PrepareInlineConfig,\n ResolvedConfig,\n TypesInlineConfig,\n TypesResult\n} from \"./types\";\nimport {\n colorText,\n format,\n formatFolder,\n getTypescriptFileHeader\n} from \"./utils\";\n\n/**\n * The Powerlines API class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n implements API<TResolvedConfig>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: Unstable_APIContext<TResolvedConfig>;\n\n /**\n * The Powerlines context\n */\n public get context(): APIContext<TResolvedConfig> {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines API instance\n *\n * @param context - The Powerlines context\n */\n private constructor(context: APIContext<TResolvedConfig>) {\n this.#context = context as Unstable_APIContext<TResolvedConfig>;\n }\n\n /**\n * Initialize a Powerlines API instance\n *\n * @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in\n * @param config - An object containing the configuration required to run Powerlines tasks.\n * @returns A new instance of the Powerlines API\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<PowerlinesAPI<TResolvedConfig>> {\n const api = new PowerlinesAPI<TResolvedConfig>(\n await PowerlinesAPIContext.from(workspaceRoot, config)\n );\n\n api.#context.$$internal = {\n api,\n addPlugin: api.#addPlugin.bind(api)\n };\n\n const timer = api.context.timer(\"Initialization\");\n api.context.info(\n `🔌 The Powerlines Engine v${packageJson.version} has started`\n );\n\n for (const plugin of api.context.config.plugins.flat(10) ?? []) {\n await api.#addPlugin(plugin);\n }\n\n if (api.context.plugins.length === 0) {\n api.context.warn(\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n );\n } else {\n api.context.info(\n `Loaded ${api.context.plugins.length} ${titleCase(\n api.context.config.framework\n )} plugin${api.context.plugins.length > 1 ? \"s\" : \"\"}: \\n${api.context.plugins\n .map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`)\n .join(\"\\n\")}`\n );\n }\n\n const pluginConfig = await api.callHook(\"config\", {\n environment: await api.context.getEnvironment(),\n sequential: true,\n result: \"merge\",\n merge: mergeConfigs\n });\n await api.context.withUserConfig(\n pluginConfig as TResolvedConfig[\"userConfig\"],\n { isHighPriority: false }\n );\n\n timer();\n\n return api;\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(\n inlineConfig: PartialKeys<TypesInlineConfig, \"command\"> = {\n command: \"types\"\n }\n ) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\n \" 🏗️ Generating typescript declarations for the Powerlines project\"\n );\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"types\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<TypesInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n if (\n context.config.skipCache === true ||\n context.persistedMeta?.checksum !== context.meta.checksum\n ) {\n context.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n context.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await this.prepare(\n defu(\n {\n output: {\n types: false\n }\n },\n inlineConfig\n ) as PrepareInlineConfig<TResolvedConfig>\n );\n }\n\n await this.#types(context);\n\n this.context.debug(\"Formatting files generated during the types step.\");\n\n await format(\n context,\n context.typesPath,\n (await context.fs.read(context.typesPath)) ?? \"\"\n );\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\n \"✔ Powerlines types generation has completed successfully\"\n );\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PartialKeys<PrepareInlineConfig, \"command\">\n | PartialKeys<TypesInlineConfig, \"command\">\n | PartialKeys<NewInlineConfig, \"command\">\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\">\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<DocsInlineConfig, \"command\">\n | PartialKeys<DeployInlineConfig, \"command\"> = { command: \"prepare\" }\n ) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\" 🏗️ Preparing the Powerlines project\");\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"prepare\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<PrepareInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"pre\"\n });\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"normal\"\n });\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"post\"\n });\n\n if (context.config.output.types !== false) {\n await this.#types(context);\n }\n\n this.context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(context, context.builtinsPath),\n formatFolder(context, context.entryPath)\n ]);\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\"✔ Powerlines preparation has completed successfully\");\n timer();\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: PartialKeys<NewInlineConfig, \"command\">) {\n const timer = this.context.timer(\"New\");\n this.context.info(\" 🆕 Creating a new Powerlines project\");\n\n inlineConfig.command ??= \"new\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<NewInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Initializing the processing options for the Powerlines project.\"\n );\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding template file to project: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.projectType === \"application\") {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding application template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n } else {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding library template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"post\"\n });\n });\n\n this.context.debug(\"✔ Powerlines new command completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig:\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<PrepareInlineConfig, \"command\"> = {\n command: \"clean\"\n }\n ) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\" 🧹 Cleaning the previous Powerlines artifacts\");\n\n inlineConfig.command ??= \"clean\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<CleanInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\"Cleaning the project's dist and artifacts directories.\");\n\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.path\n )\n );\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.output.artifactsPath\n )\n );\n\n await this.callHook(\"clean\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig:\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\"> = { command: \"lint\" }\n ) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\" 📝 Linting the Powerlines project\");\n\n inlineConfig.command ??= \"lint\";\n await this.prepare(\n inlineConfig as RequiredKeys<LintInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"lint\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines linting completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(\n inlineConfig: PartialKeys<BuildInlineConfig, \"command\"> = {\n command: \"build\"\n }\n ) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\" 📦 Building the Powerlines project\");\n\n await this.context.generateChecksum();\n if (\n this.context.meta.checksum !== this.context.persistedMeta?.checksum ||\n this.context.config.skipCache\n ) {\n this.context.info(\n !this.context.persistedMeta?.checksum\n ? \"No previous build cache found. Preparing the project for the initial build.\"\n : this.context.meta.checksum !== this.context.persistedMeta.checksum\n ? \"The project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n : \"The project is configured to skip cache. Re-preparing the project.\"\n );\n\n inlineConfig.command ??= \"build\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<BuildInlineConfig, \"command\">\n );\n }\n\n if (this.context.config.singleBuild) {\n await this.#handleBuild(await this.#context.toEnvironment());\n } else {\n await this.#executeEnvironments(async context => {\n await this.#handleBuild(context);\n });\n }\n\n this.context.debug(\"✔ Powerlines build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig = { command: \"docs\" }) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\n \" 📓 Generating documentation for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"docs\";\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Writing documentation for the Powerlines project artifacts.\"\n );\n\n inlineConfig.command ??= \"docs\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"docs\", {\n environment: context\n });\n });\n });\n\n this.context.debug(\n \"✔ Powerlines documentation generation completed successfully\"\n );\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: PartialKeys<DeployInlineConfig, \"command\"> = {\n command: \"deploy\"\n }\n ) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\" 🚀 Deploying the Powerlines project\");\n\n inlineConfig.command ??= \"deploy\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DeployInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"deploy\", { environment: context });\n });\n\n this.context.debug(\"✔ Powerlines deploy completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalization\");\n this.context.info(\" 🏁 Powerlines finalization processes started\");\n\n await this.#executeEnvironments(async context => {\n await this.callHook(\"finalize\", { environment: context });\n await context.fs.dispose();\n\n if (\n existsSync(context.cachePath) &&\n !(await listFiles(joinPaths(context.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(context.cachePath);\n }\n });\n\n this.context.debug(\"✔ Powerlines finalization completed successfully\");\n timer();\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 async callHook<TKey extends string>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig>;\n },\n ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>\n ) {\n return callHook<TResolvedConfig, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await this.#context.getEnvironment(options?.environment),\n hook,\n { sequential: true, ...options },\n ...args\n );\n }\n\n /**\n * Dispose of the Powerlines API instance\n *\n * @remarks\n * This method will finalize the Powerlines API instance, cleaning up any resources used.\n */\n public async [Symbol.asyncDispose]() {\n await this.finalize();\n }\n\n async #handleBuild(context: EnvironmentContext<TResolvedConfig>) {\n await this.callHook(\"build\", {\n environment: context,\n order: \"pre\"\n });\n\n context.debug(\n \"Formatting the generated entry files before the build process starts.\"\n );\n await formatFolder(context, context.entryPath);\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.output.copy) {\n context.debug(\"Copying project's files from build output directory.\");\n\n const destinationPath = isParentPath(\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(context.config.root, context.workspaceConfig.workspaceRoot)\n )\n ? joinPaths(\n context.config.output.copy.path,\n relativePath(\n appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : joinPaths(context.config.output.copy.path, \"dist\");\n const sourcePath = appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n );\n\n if (existsSync(sourcePath) && sourcePath !== destinationPath) {\n context.debug(\n `Copying files from project's build output directory (${\n context.config.output.path\n }) to the project's copy/publish directory (${destinationPath}).`\n );\n\n await copyFiles(sourcePath, destinationPath);\n } else {\n context.warn(\n `The source path for the copy operation ${\n !existsSync(sourcePath)\n ? \"does not exist\"\n : \"is the same as the destination path\"\n }. Source: ${sourcePath}, Destination: ${\n destinationPath\n }. Skipping copying of build output files.`\n );\n }\n\n if (\n context.config.output.copy.assets &&\n Array.isArray(context.config.output.copy.assets)\n ) {\n await Promise.all(\n context.config.output.copy.assets.map(async asset => {\n context.trace(\n `Copying asset(s): ${chalk.redBright(\n context.workspaceConfig.workspaceRoot === asset.input\n ? asset.glob\n : appendPath(\n asset.glob,\n replacePath(\n asset.input,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} -> ${chalk.greenBright(\n appendPath(\n asset.glob,\n replacePath(\n asset.output,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await context.fs.copy(asset, asset.output);\n })\n );\n }\n } else {\n context.debug(\n \"No copy configuration found for the project output. Skipping the copying of build output files.\"\n );\n }\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"post\"\n });\n }\n\n /**\n * Get the configured environments\n *\n * @returns The configured environments\n */\n async #getEnvironments() {\n if (\n !this.context.config.environments ||\n Object.keys(this.context.config.environments).length <= 1\n ) {\n this.context.debug(\n \"No environments are configured for this Powerlines project. Using the default environment.\"\n );\n\n return [await this.context.getEnvironment()];\n }\n\n this.context.debug(\n `Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`\n );\n\n return (\n await Promise.all(\n Object.entries(this.context.config.environments).map(\n async ([name, config]) => {\n const environment = await this.context.getEnvironmentSafe(name);\n if (!environment) {\n const resolvedEnvironment = await this.callHook(\n \"configEnvironment\",\n {\n environment: name\n },\n name,\n config\n );\n\n if (resolvedEnvironment) {\n this.context.environments[name] = await this.context.in(\n resolvedEnvironment as EnvironmentResolvedConfig\n );\n }\n }\n\n return this.context.environments[name];\n }\n )\n )\n ).filter(context => isSet(context));\n }\n\n /**\n * Execute a handler function for each environment\n *\n * @param handle - The handler function to execute for each environment\n */\n async #executeEnvironments(\n handle: (context: EnvironmentContext<TResolvedConfig>) => MaybePromise<void>\n ) {\n await Promise.all(\n (await this.#getEnvironments()).map(async context => {\n return Promise.resolve(handle(context));\n })\n );\n }\n\n /**\n * Add a Powerlines plugin used in the build process\n *\n * @param config - The import path of the plugin to add\n */\n async #addPlugin(config: PluginConfig<PluginContext<TResolvedConfig>>) {\n if (config) {\n const result = await this.#initPlugin(config);\n if (!result) {\n return;\n }\n\n for (const plugin of result) {\n this.context.debug(\n `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n );\n\n await this.context.addPlugin(plugin);\n }\n }\n }\n\n /**\n * Initialize a Powerlines plugin\n *\n * @param config - The configuration for the plugin\n * @returns The initialized plugin instance, or null if the plugin was a duplicate\n * @throws Will throw an error if the plugin cannot be found or is invalid\n */\n async #initPlugin(\n config: PluginConfig<PluginContext<TResolvedConfig>>\n ): Promise<Plugin<PluginContext<TResolvedConfig>>[] | null> {\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = (await Promise.resolve(config as Promise<any>)) as PluginConfig<\n PluginContext<TResolvedConfig>\n >;\n }\n\n if (!isPluginConfig<PluginContext<TResolvedConfig>>(awaited)) {\n const invalid = findInvalidPluginConfig(awaited);\n\n throw new Error(\n `Invalid ${\n invalid && invalid.length > 1 ? \"plugins\" : \"plugin\"\n } specified in the configuration - ${\n invalid && invalid.length > 0\n ? JSON.stringify(awaited)\n : invalid?.join(\"\\n\\n\")\n } \\n\\nPlease ensure the value is one of the following: \\n - an instance of \\`Plugin\\` \\n - a plugin name \\n - an object with the \\`plugin\\` and \\`options\\` properties \\n - a tuple array with the plugin and options \\n - a factory function that returns a plugin or array of plugins \\n - an array of plugins or plugin configurations`\n );\n }\n\n let plugins!: Plugin<PluginContext<TResolvedConfig>>[];\n if (isPlugin<PluginContext<TResolvedConfig>>(awaited)) {\n plugins = [awaited];\n } else if (isFunction(awaited)) {\n plugins = toArray(await Promise.resolve(awaited()));\n } else if (isString(awaited)) {\n const resolved = await this.#resolvePlugin(awaited);\n if (isFunction(resolved)) {\n plugins = toArray(await Promise.resolve(resolved()));\n } else {\n plugins = toArray(resolved);\n }\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginContext<TResolvedConfig>[]).every(\n isPlugin<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = awaited as Plugin<PluginContext<TResolvedConfig>>[];\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginConfig<PluginContext<TResolvedConfig>>[]).every(\n isPluginConfig<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = [];\n for (const pluginConfig of awaited as PluginConfig<\n PluginContext<TResolvedConfig>\n >[]) {\n const initialized = await this.#initPlugin(pluginConfig);\n if (initialized) {\n plugins.push(...initialized);\n }\n }\n } else if (\n isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited) ||\n isPluginConfigObject<PluginContext<TResolvedConfig>>(awaited)\n ) {\n let pluginConfig!:\n | string\n | PluginFactory<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited)) {\n pluginConfig = awaited[0] as Plugin<PluginContext<TResolvedConfig>>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = (awaited as PluginConfigObject).plugin as Plugin<\n PluginContext<TResolvedConfig>\n >;\n pluginOptions = (awaited as PluginConfigObject).options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await this.#resolvePlugin(pluginConfig);\n if (isFunction(resolved)) {\n plugins = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n plugins = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n plugins = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n plugins = pluginConfig;\n } else if (isPlugin<PluginContext<TResolvedConfig>>(pluginConfig)) {\n plugins = toArray(pluginConfig);\n }\n }\n\n if (!plugins) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (\n plugins.length > 0 &&\n !plugins.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n throw new Error(\n `The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n const result = [] as Plugin<PluginContext<TResolvedConfig>>[];\n for (const plugin of plugins) {\n if (isDuplicate<TResolvedConfig>(plugin, this.context.plugins)) {\n this.context.trace(\n `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n );\n } else {\n result.push(plugin);\n\n this.context.trace(\n `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n );\n }\n }\n\n return result;\n }\n\n async #resolvePlugin<TOptions>(\n pluginPath: string\n ): Promise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n | ((\n options?: TOptions\n ) => MaybePromise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n >)\n > {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [\n this.context.workspaceConfig.workspaceRoot,\n this.context.config.root\n ]\n });\n if (!isInstalled && this.context.config.autoInstall) {\n this.#context.warn(\n `The plugin package \"${\n pluginPath\n }\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: this.context.config.root\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n this.#context.error(result.stderr);\n\n throw new Error(\n `An error occurred while installing the build plugin package \"${\n pluginPath\n }\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(\n this.context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\"))\n );\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(this.context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: Please ensure the plugin package's default export is a class that extends \\`Plugin\\` with a constructor that excepts a single arguments of type \\`PluginOptions\\`.`\n );\n }\n }\n }\n }\n\n /**\n * Generate the Powerlines TypeScript declaration file\n *\n * @remarks\n * This method will generate the TypeScript declaration file for the Powerlines project, including any types provided by plugins.\n *\n * @param context - The environment context to use for generating the TypeScript declaration file\n * @returns A promise that resolves when the TypeScript declaration file has been generated\n */\n async #types(context: EnvironmentContext<TResolvedConfig>) {\n context.debug(\n `Preparing the TypeScript definitions for the Powerlines project.`\n );\n\n if (context.fs.existsSync(context.typesPath)) {\n await context.fs.remove(context.typesPath);\n }\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n context.debug(\n \"Running TypeScript compiler for built-in runtime module files.\"\n );\n\n let { code, directives } = await emitBuiltinTypes(\n context,\n (await context.getBuiltins()).reduce<string[]>((ret, builtin) => {\n const formatted = replacePath(\n builtin.path,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n }, [])\n );\n\n context.debug(\n `Generating TypeScript declaration file ${context.typesPath}.`\n );\n\n const merge = async (\n currentResult: string | TypesResult,\n previousResult: string | TypesResult\n ): Promise<string | TypesResult> => {\n if (\n !isSetString(currentResult) &&\n !isSetObject(currentResult) &&\n !isSetString(previousResult) &&\n !isSetObject(previousResult)\n ) {\n return { code, directives };\n }\n\n const previous = (\n await format(\n context,\n context.typesPath,\n isSetString(previousResult)\n ? previousResult\n : isSetObject(previousResult)\n ? previousResult.code\n : \"\"\n )\n )\n .trim()\n .replace(code, \"\")\n .trim();\n const current = (\n await format(\n context,\n context.typesPath,\n isSetString(currentResult)\n ? currentResult\n : isSetObject(currentResult)\n ? currentResult.code\n : \"\"\n )\n )\n .trim()\n .replace(previous, \"\")\n .trim()\n .replace(code, \"\")\n .trim();\n\n return {\n directives: [\n ...(isSetObject(currentResult) && currentResult.directives\n ? currentResult.directives\n : []),\n ...(isSetObject(previousResult) && previousResult.directives\n ? previousResult.directives\n : [])\n ],\n code: await format(\n context,\n context.typesPath,\n `${\n !previous.includes(getTypescriptFileHeader(context)) &&\n !current.includes(getTypescriptFileHeader(context))\n ? `${code}\\n`\n : \"\"\n }${previous}\\n${current}`.trim()\n )\n };\n };\n const asNextParam = (\n previousResult: string | TypesResult | null | undefined\n ) => (isObject(previousResult) ? previousResult.code : previousResult);\n\n let result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"pre\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"normal\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"post\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n if (isSetString(code?.trim()) || directives.length > 0) {\n await context.fs.write(\n context.typesPath,\n `${\n directives.length > 0\n ? `${directives.map(directive => `/// <reference types=\"${directive}\" />`).join(\"\\n\")}\n\n`\n : \"\"\n }${getTypescriptFileHeader(context, { directive: null, prettierIgnore: false })}\n\n${formatTypes(code)}\n`\n );\n }\n\n // else {\n // const dtsRelativePath = getTsconfigDtsPath(context);\n // if (\n // context.tsconfig.tsconfigJson.include &&\n // isIncludeMatchFound(\n // dtsRelativePath,\n // context.tsconfig.tsconfigJson.include\n // )\n // ) {\n // const normalizedDtsRelativePath = dtsRelativePath.startsWith(\"./\")\n // ? dtsRelativePath.slice(2)\n // : dtsRelativePath;\n // context.tsconfig.tsconfigJson.include =\n // context.tsconfig.tsconfigJson.include.filter(\n // includeValue =>\n // includeValue?.toString() !== normalizedDtsRelativePath\n // );\n\n // await context.fs.write(\n // context.tsconfig.tsconfigFilePath,\n // JSON.stringify(context.tsconfig.tsconfigJson, null, 2)\n // );\n // }\n // }\n\n // // Re-resolve the tsconfig to ensure it is up to date\n // context.tsconfig = getParsedTypeScriptConfig(\n // context.workspaceConfig.workspaceRoot,\n // context.config.root,\n // context.config.tsconfig\n // );\n // if (!context.tsconfig) {\n // throw new Error(\"Failed to parse the TypeScript configuration file.\");\n // }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6EA,SAAgB,YAAY,OAAO,IAAY;AAC7C,QAAO,KAAK,WAAW,aAAa,GAAG,CAAC,QAAQ,QAAQ,GAAG;;AAG7D,eAAe,0BACb,KACA,UACA,MACA,MAC4B;CAC5B,MAAM,UAAmC,EAAE;CAC3C,MAAM,UAA8C,EAAE;CAEtD,MAAM,UAAU,KACb,MACC,IAAI,OACF,+BACE,IAAI,QAAQ,OAAO,UACpB,GAAG,KAAK,oBACV,CACF,EACC,MAAK,YAAW,YAAY,SAAS,MAAM,CAAC,CAAC;CAIjD,MAAM,aADU,IAAI,QAAQ,EAAE,uBAAuB,MAAM,CAAC,CACjC,iBAAiB,eAAe,KAAK;AAGhE,MAAK,MAAM,OAAO,WAAW,4BAA4B,CACvD,KACE,IAAI,aAAa,IACjB,CAAC,IAAI,QAAQ,SAAS,MAAK,YAAW,IAAI,aAAa,CAAC,SAAS,QAAQ,CAAC,CAE1E,SAAQ,KAAK;EACX,MAAM,IAAI,aAAa;EACvB,SAAS;EACV,CAAC;AAIN,MAAK,MAAM,aAAa,WAAW,eAAe,CAEhD,KAAI,KAAK,oBAAoB,UAAU,EAAE;EACvC,MAAM,aAAa,UAAU,yBAAyB;AAGtD,MAAI,UAAU,oBAAoB,CAChC,SAAQ,KAAK;GACX,MAAM;GACN,YAAY,CACV,EACE,MAAM,UAAU,oBAAoB,CAAE,SAAS,EAChD,CACF;GACD,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,WAAW,CAAC,CAAC,OAC5D,QACD;cAEM,YAAY,OAAO,CAC5B,QAAO;;AAIX,WAAS,MAAM,KAAK,SAClB,SACA;GACE,aAAa;GACb,YAAY;GACZ,OAAO;GACP,QAAQ;GACR;GACA;GACD,EACD,KACD;AACD,MAAI,QACF;OAAI,YAAY,OAAO,EAAE;AACvB,WAAO,OAAO;AACd,QAAI,MAAM,QAAQ,OAAO,WAAW,IAAI,OAAO,WAAW,SAAS,EACjE,cAAa,UAAU,CAAC,GAAG,YAAY,GAAG,OAAO,WAAW,CAAC,CAAC,OAC5D,QACD;cAEM,YAAY,OAAO,CAC5B,QAAO;;AAIX,WAAS,MAAM,KAAK,SAClB,SACA;GACE,aAAa;GACb,YAAY;GACZ,OAAO;GACP,QAAQ;GACR;GACA;GACD,EACD,KACD;AACD,MAAI,QACF;OAAI,YAAY,OAAO,EAAE;AACvB,WAAO,OAAO;AACd,QAAI,MAAM,QAAQ,OAAO,WAAW,IAAI,OAAO,WAAW,SAAS,EACjE,cAAa,UAAU,CAAC,GAAG,YAAY,GAAG,OAAO,WAAW,CAAC,CAAC,OAC5D,QACD;cAEM,YAAY,OAAO,CAC5B,QAAO;;AAIX,MAAI,YAAY,MAAM,MAAM,CAAC,IAAI,WAAW,SAAS,EACnD,OAAM,QAAQ,GAAG,MACf,QAAQ,WACR,GACE,WAAW,SAAS,IAChB,GAAG,WAAW,KAAI,cAAa,yBAAyB,UAAU,MAAM,CAAC,KAAK,KAAK,CAAC;;IAGpF,gDACqB,SAAS;GAAE,WAAW;GAAM,gBAAgB;GAAO,CAAC,CAAC;;EAEtF,YAAY,KAAK,CAAC;EAEb"}
1
+ {"version":3,"file":"api-ObH5-iUb.mjs","names":["#context","#addPlugin","packageJson.version","#executeEnvironments","defu","#types","#handleBuild","#getEnvironments","#initPlugin","#resolvePlugin","isPlugin","isPluginConfig"],"sources":["../package.json","../src/_internal/helpers/generate-types.ts","../src/_internal/helpers/install.ts","../src/_internal/helpers/install-dependencies.ts","../src/_internal/helpers/resolve-tsconfig.ts","../src/api.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 { appendPath } from \"@stryke/path/append\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\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 { DiagnosticCategory, Node, Project, SourceFile } from \"ts-morph\";\nimport { Context } from \"../../types\";\nimport { createProgram } from \"../../typescript/ts-morph\";\nimport { format } from \"../../utils\";\n\ninterface ModuleExportSpecifier {\n name: string;\n alias?: string;\n default?: boolean;\n type?: boolean;\n}\n\ninterface ModuleReference {\n name?: string;\n specifiers?: ModuleExportSpecifier[];\n all?: boolean;\n}\n\ninterface ImportModuleReference extends ModuleReference {\n name: string;\n ambient?: boolean;\n}\n\ninterface ExportModuleReference extends ModuleReference {\n text: string;\n fullText: string;\n comment?: string;\n}\n\ninterface ModuleDeclaration {\n name: string;\n text: string;\n sourceFile: SourceFile;\n comment?: string;\n exports: (ExportModuleReference | string)[];\n imports: ImportModuleReference[];\n}\n\nexport interface TypegenContext {\n context: Context;\n emitted: Map<string, string>;\n modules: ModuleDeclaration[];\n}\n\n/**\n * Formats the generated TypeScript types source code.\n *\n * @param code - The generated TypeScript code.\n * @returns The formatted TypeScript code.\n */\nexport function formatTypes(code = \"\"): string {\n return code.replaceAll(\"#private;\", \"\").replace(/__Ω/g, \"\");\n}\n\nasync function extractModuleDeclarations(\n ctx: TypegenContext,\n filePath: string,\n name: string,\n text: string\n): Promise<ModuleDeclaration> {\n const imports: ImportModuleReference[] = [];\n const exports: (ExportModuleReference | string)[] = [];\n\n const comment = text\n .match(\n new RegExp(\n `\\\\/\\\\*\\\\*(?s:.)*?@module\\\\s+${\n ctx.context.config.framework\n }:${name}(?s:.)*?\\\\*\\\\/\\\\s+`\n )\n )\n ?.find(comment => isSetString(comment?.trim()));\n\n // Parse the emitted .d.ts content using an in-memory ts-morph project\n const project = new Project({ useInMemoryFileSystem: true });\n const sourceFile = project.createSourceFile(\"module.d.ts\", text);\n\n // Collect /// <reference types=\"...\" /> directives as ambient dependencies\n for (const ref of sourceFile.getTypeReferenceDirectives()) {\n if (\n ref.getFileName() &&\n !ctx.context.builtins.some(builtin => ref.getFileName().endsWith(builtin))\n ) {\n imports.push({\n name: ref.getFileName(),\n ambient: true\n });\n }\n }\n\n for (const statement of sourceFile.getStatements()) {\n // --- Import declarations ---\n if (Node.isImportDeclaration(statement)) {\n const moduleSpec = statement.getModuleSpecifierValue();\n\n // Namespace import: import * as X from '...'\n if (statement.getNamespaceImport()) {\n imports.push({\n name: moduleSpec,\n specifiers: [\n {\n name: statement.getNamespaceImport()!.getText()\n }\n ],\n all: true\n });\n }\n\n // Named imports: import X from '...' or import { A, B as C } from '...'\n else if (\n statement.getNamedImports().length > 0 ||\n statement.getDefaultImport()\n ) {\n const specifiers: ModuleExportSpecifier[] = [];\n if (statement.getDefaultImport()) {\n specifiers.push({\n name: statement.getDefaultImport()!.getText(),\n default: true,\n type: statement.isTypeOnly()\n });\n }\n\n statement.getNamedImports().forEach(named => {\n specifiers.push({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n });\n });\n\n imports.push({\n name: moduleSpec,\n specifiers\n });\n }\n }\n\n // --- Export declarations ---\n else if (Node.isExportDeclaration(statement)) {\n const moduleSpec = statement.getModuleSpecifierValue();\n if (moduleSpec) {\n // Resolve the module specifier\n let resolvedSpec = moduleSpec;\n if (!ctx.context.builtins.includes(moduleSpec)) {\n if (ctx.emitted.has(moduleSpec)) {\n resolvedSpec = ctx.emitted.get(moduleSpec)!;\n } else {\n const resolvedModule = await ctx.context.resolve(\n moduleSpec,\n filePath\n );\n if (isSetString(resolvedModule?.id)) {\n resolvedSpec = resolvedModule.id;\n }\n }\n }\n\n // Re-export from another module\n const namedExports = statement.getNamedExports();\n if (namedExports.length > 0) {\n exports.push({\n name: resolvedSpec,\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: namedExports.map(named => ({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n })),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n .trim()\n });\n } else {\n // export * from '...'\n exports.push({\n name: resolvedSpec,\n text: statement.getText(),\n fullText: statement.getFullText(),\n all: true,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n .trim()\n });\n }\n } else {\n const specifiers = statement.getNamedExports().map(named => ({\n name: named.getName(),\n alias: named.getAliasNode()?.getText(),\n type: statement.isTypeOnly()\n }));\n if (specifiers.length > 0) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n }\n }\n\n // --- Export assignments (export default ...) ---\n else if (Node.isExportAssignment(statement)) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Function declarations (export declare function ...) ---\n else if (\n Node.isFunctionDeclaration(statement) &&\n statement.isExported() &&\n statement.getNameNode()\n ) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: [\n {\n name: statement.getNameNode()!.getText()\n }\n ],\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Variable statements (export declare const ...) ---\n else if (Node.isVariableStatement(statement) && statement.isExported()) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: statement\n .getDeclarationList()\n .getDeclarations()\n .filter(\n decl => decl.getNameNode() && Node.isIdentifier(decl.getNameNode())\n )\n .map(decl => ({ name: decl.getNameNode().getText() })),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Class declarations (export declare class ...) ---\n else if (Node.isClassDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Interface declarations (export declare interface ...) ---\n else if (Node.isInterfaceDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- Type alias declarations (export declare type ...) ---\n else if (Node.isTypeAliasDeclaration(statement) && statement.isExported()) {\n const nameNode = statement.getNameNode();\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n specifiers: nameNode ? [{ name: nameNode.getText() }] : undefined,\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n\n // --- All other statements (declarations) ---\n else if (\n ctx.context.config.output.sourceMap ||\n !statement.getFullText().includes(\"//# sourceMappingURL=\")\n ) {\n exports.push({\n text: statement.getText(),\n fullText: statement.getFullText(),\n comment: statement\n .getLeadingCommentRanges()\n .filter(\n c =>\n isSetString(c.getText().trim()) &&\n !c.getText().includes(\"@module\")\n )\n .map(c => c.getText().trim())\n .join(\"\\n\")\n });\n }\n }\n\n return {\n name,\n text,\n sourceFile,\n comment,\n imports,\n exports\n };\n}\n\n/**\n * Emits TypeScript declaration types for the provided files using the given TypeScript configuration.\n *\n * @param context - The context containing options and environment paths.\n * @param files - The list of files to generate types for.\n * @returns A promise that resolves to the generated TypeScript declaration types.\n */\nexport async function emitBuiltinTypes<TContext extends Context>(\n context: TContext,\n files: string[]\n): Promise<{ code: string; directives: string[] }> {\n if (files.length === 0) {\n context.debug(\n \"No files provided for TypeScript types generation. Typescript compilation for built-in modules will be skipped.\"\n );\n return { code: \"\", directives: [] };\n }\n\n context.debug(\n `Running the TypeScript compiler for ${\n files.length\n } generated built-in module files.`\n );\n\n const program = createProgram(context, {\n skipAddingFilesFromTsConfig: true,\n compilerOptions: {\n declaration: true,\n declarationMap: false,\n emitDeclarationOnly: true,\n sourceMap: false,\n outDir: replacePath(\n context.builtinsPath,\n context.workspaceConfig.workspaceRoot\n ),\n composite: false,\n incremental: false,\n tsBuildInfoFile: undefined\n }\n });\n\n program.addSourceFilesAtPaths(files);\n const emitResult = program.emitToMemory({ emitOnlyDtsFiles: true });\n\n const diagnostics = emitResult.getDiagnostics();\n if (diagnostics && diagnostics.length > 0) {\n if (diagnostics.some(d => d.getCategory() === DiagnosticCategory.Error)) {\n throw new Error(\n `The Typescript emit process failed while generating built-in types: \\n ${diagnostics\n .filter(d => d.getCategory() === DiagnosticCategory.Error)\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n } else if (\n diagnostics.some(d => d.getCategory() === DiagnosticCategory.Warning)\n ) {\n context.warn(\n `The Typescript emit process completed with warnings while generating built-in types: \\n ${diagnostics\n .filter(d => d.getCategory() === DiagnosticCategory.Warning)\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n } else {\n context.debug(\n `The Typescript emit process completed with diagnostic messages while generating built-in types: \\n ${diagnostics\n .map(\n d =>\n `-${d.getSourceFile() ? `${d.getSourceFile()?.getFilePath()}:` : \"\"} ${String(\n d.getMessageText()\n )} (at ${d.getStart()}:${d.getLength()})`\n )\n .join(\"\\n\")}`\n );\n }\n }\n\n const emittedFiles = emitResult.getFiles();\n context.debug(\n `The TypeScript compiler emitted ${\n emittedFiles.length\n } files for built-in types.`\n );\n\n if (emittedFiles.length === 0) {\n context.warn(\n \"The TypeScript compiler did not emit any files for built-in types. This may indicate an issue with the TypeScript configuration or the provided files.\"\n );\n return { code: \"\", directives: [] };\n }\n\n const ctx = {\n context,\n modules: [] as ModuleDeclaration[],\n emitted: new Map<string, string>()\n };\n\n await Promise.all(\n emittedFiles.map(async emittedFile => {\n const filePath = appendPath(\n emittedFile.filePath,\n context.workspaceConfig.workspaceRoot\n );\n if (\n !filePath.endsWith(\".map\") &&\n findFileName(filePath) !== \"tsconfig.tsbuildinfo\" &&\n isParentPath(filePath, context.builtinsPath)\n ) {\n const moduleName = replaceExtension(\n replacePath(\n replacePath(filePath, context.builtinsPath),\n replacePath(\n context.builtinsPath,\n context.workspaceConfig.workspaceRoot\n )\n ),\n \"\",\n {\n fullExtension: true\n }\n );\n if (context.builtins.includes(moduleName)) {\n ctx.emitted.set(filePath, moduleName);\n ctx.modules.push(\n await extractModuleDeclarations(\n ctx,\n filePath,\n moduleName,\n emittedFile.text\n )\n );\n }\n }\n })\n );\n\n const commonDeclarations = [] as ExportModuleReference[];\n for (const mod of ctx.modules) {\n for (const importRef of mod.imports.filter(importRef =>\n context.builtins.some(builtin => importRef.name.endsWith(`:${builtin}`))\n )) {\n const moduleRef = ctx.modules.find(moduleRef =>\n importRef.name.endsWith(`:${moduleRef.name}`)\n );\n if (moduleRef) {\n let declaration: ExportModuleReference | undefined;\n for (const decl of moduleRef.exports.filter(decl =>\n isSetObject(decl)\n )) {\n const specifiers = decl.specifiers?.filter(specifier =>\n importRef.specifiers?.some(\n s =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n );\n if (specifiers && specifiers.length > 0) {\n importRef.specifiers = importRef.specifiers?.filter(\n s =>\n !specifiers.some(\n specifier =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n );\n if (\n importRef.specifiers &&\n importRef.specifiers.length === 0 &&\n !importRef.all &&\n !importRef.ambient\n ) {\n mod.imports = mod.imports.filter(\n imp => imp.name !== importRef.name\n );\n }\n\n declaration = decl;\n break;\n }\n }\n\n if (declaration) {\n for (const decl of moduleRef.exports.filter(\n decl =>\n isSetObject(decl) &&\n !decl.specifiers?.some(s =>\n declaration?.specifiers?.some(\n specifier =>\n (specifier.alias ? specifier.alias : specifier.name) ===\n (s.alias ? s.alias : s.name)\n )\n )\n )) {\n const exportModuleRef = decl as ExportModuleReference;\n if (\n (exportModuleRef.specifiers?.some(s => s.alias || s.name) ||\n exportModuleRef.name) &&\n new RegExp(\n `(^|\\\\s|\\\\n|\\\\r\\\\n|\\\\(|\\\\)|<|>|{|}|\\\\[|\\\\]|\\\\!|\\\\?|\\\\.|,|\\\\*|&|:)(${\n exportModuleRef.specifiers\n ?.map(s => `${s.alias ? `${s.alias}|` : \"\"}${s.name}`)\n .join(\"|\") || exportModuleRef.name\n })($|\\\\s|\\\\n|\\\\r\\\\n|\\\\(|\\\\)|<|>|{|}|\\\\[|\\\\]|\\\\!|\\\\?|\\\\.|,|\\\\*|&|:|;)`\n ).test(declaration.text)\n ) {\n commonDeclarations.push(exportModuleRef);\n }\n }\n commonDeclarations.push(declaration);\n }\n }\n }\n }\n\n let code = \"\";\n const directives: string[] = [];\n\n for (const commonDeclaration of commonDeclarations) {\n code += formatTypes(\n `${\n commonDeclaration.comment?.trim()\n ? commonDeclaration.comment.trim()\n : \"\"\n }${commonDeclaration.comment?.trim() ? \"\\n\" : \"\"}${formatTypes(\n commonDeclaration.text\n .replace(/\\s*export\\s*/, \"\")\n .replace(/\\s*declare\\s*interface\\s*/, \"interface \")\n .replace(/\\s*declare\\s*type\\s*/, \"type \")\n )}`\n );\n code += \"\\n\\n\";\n }\n\n for (const mod of ctx.modules) {\n code += mod.comment ? `${mod.comment.trim()}\\n` : \"\";\n code += `declare module \"${context.config.framework}:${mod.name}\" { \\n`;\n for (const importRef of mod.imports) {\n if (importRef.ambient) {\n code += directives.push(importRef.name);\n } else if (importRef.all) {\n code += `\\timport * as ${findFileName(importRef.name)} from \"${importRef.name}\";\\n`;\n } else if (importRef.specifiers) {\n const typeOnly = importRef.specifiers.every(s => s.type) ? \" type\" : \"\";\n const specifiers = importRef.specifiers\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \");\n code += `\\timport${typeOnly} { ${specifiers} } from \"${importRef.name}\";\\n`;\n }\n }\n\n if (mod.imports.length > 0) {\n code += \"\\n\";\n }\n\n for (const exportRef of mod.exports.filter(\n e =>\n isString(e) ||\n !e.specifiers ||\n !commonDeclarations.some(\n commonDecl =>\n commonDecl.specifiers &&\n commonDecl.specifiers.some(specifier =>\n e.specifiers?.some(\n s =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n )) {\n if (isSetString(exportRef)) {\n code += `${exportRef}\\n`;\n } else if (exportRef.name) {\n if (exportRef.all) {\n code += `${\n exportRef.comment?.trim() ? exportRef.comment.trim() : \"\"\n }${\n exportRef.comment?.trim() ? \"\\n\" : \"\"\n }export * from \"${exportRef.name}\";\\n`;\n } else if (exportRef.specifiers) {\n if (exportRef.comment?.trim()) {\n code += `${exportRef.comment.trim()}\\n`;\n }\n\n code += `\\texport${\n exportRef.specifiers.every(s => s.type) ? \" type\" : \"\"\n } { ${exportRef.specifiers\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \")} } from \"${exportRef.name}\";\\n`;\n }\n } else {\n code += `${exportRef.comment?.trim() ? exportRef.comment.trim() : \"\"}${\n exportRef.comment?.trim() ? \"\\n\" : \"\"\n }${formatTypes(\n exportRef.text\n .replace(/\\s*export\\s*declare\\s*/, \"export \")\n .replace(/\\s*declare\\s*/, \" \")\n )}\\n`;\n }\n }\n\n mod.exports\n .filter(\n e =>\n !isString(e) &&\n e.specifiers &&\n commonDeclarations.some(\n commonDeclaration =>\n commonDeclaration.specifiers &&\n commonDeclaration.specifiers.some(specifier =>\n e.specifiers?.some(\n s =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n )\n .forEach((e, i, arr) => {\n if (i === 0) {\n code += \"\\nexport { \";\n } else {\n code += \", \";\n }\n\n code += `${\n (e as ExportModuleReference)?.specifiers\n ?.filter(s =>\n commonDeclarations.some(\n commonDeclaration =>\n commonDeclaration.specifiers &&\n commonDeclaration.specifiers.some(\n specifier =>\n (s.alias ? s.alias : s.name) ===\n (specifier.alias ? specifier.alias : specifier.name)\n )\n )\n )\n .map(s => (s.alias ? `${s.name} as ${s.alias}` : s.name))\n .join(\", \") || \"\"\n }`;\n\n if (i === arr.length - 1) {\n code += ` };\\n`;\n }\n });\n\n code += \"}\";\n code += \"\\n\\n\";\n }\n\n code = await format(context, context.typesPath, code);\n\n context.debug(\n `A TypeScript declaration file (size: ${prettyBytes(\n new Blob(toArray(code)).size\n )}) emitted for the built-in modules types.`\n );\n\n return { code, directives };\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { install } from \"@stryke/fs/install\";\nimport {\n doesPackageMatch,\n getPackageListing,\n isPackageListed\n} from \"@stryke/fs/package-fns\";\nimport {\n getPackageName,\n getPackageVersion,\n hasPackageVersion\n} from \"@stryke/string-format/package\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport type { Context } from \"../../types\";\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packageName - The name of the package to install\n * @param dev - Whether to install the package as a dev dependency\n */\nexport async function installPackage(\n context: Context,\n packageName: string,\n dev = false\n) {\n if (\n !(await isPackageListed(getPackageName(packageName), {\n cwd: context.config.root\n }))\n ) {\n if (context.config.autoInstall) {\n context.warn(\n `The package \"${packageName}\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(packageName, {\n cwd: context.config.root,\n dev\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n context.error(result.stderr);\n throw new Error(\n `An error occurred while installing the package \"${packageName}\"`\n );\n }\n } else {\n context.warn(\n `The package \"${packageName}\" is not installed. Since the \"autoInstall\" option is set to false, it will not be installed automatically.`\n );\n }\n } else if (\n hasPackageVersion(packageName) &&\n !process.env.POWERLINES_SKIP_VERSION_CHECK\n ) {\n const isMatching = await doesPackageMatch(\n getPackageName(packageName),\n getPackageVersion(packageName)!,\n context.config.root\n );\n if (!isMatching) {\n const packageListing = await getPackageListing(\n getPackageName(packageName),\n {\n cwd: context.config.root\n }\n );\n if (\n !packageListing?.version.startsWith(\"catalog:\") &&\n !packageListing?.version.startsWith(\"workspace:\")\n ) {\n context.warn(\n `The package \"${getPackageName(packageName)}\" is installed but does not match the expected version ${getPackageVersion(\n packageName\n )} (installed version: ${packageListing?.version || \"<Unknown>\"}). Please ensure this is intentional before proceeding. Note: You can skip this validation with the \"STORM_STACK_SKIP_VERSION_CHECK\" environment variable.`\n );\n }\n }\n }\n}\n\n/**\n * Installs a package if it is not already installed.\n *\n * @param context - The resolved options\n * @param packages - The list of packages to install\n */\nexport async function installPackages(\n context: Context,\n packages: Array<{ name: string; dev?: boolean }>\n) {\n return Promise.all(\n packages.map(async pkg => installPackage(context, pkg.name, pkg.dev))\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getPackageName } from \"@stryke/string-format/package\";\nimport { Context } from \"../../types\";\nimport { installPackage } from \"./install\";\n\n/**\n * Install missing project dependencies.\n *\n * @param context - The build context.\n */\nexport async function installDependencies<TContext extends Context = Context>(\n context: TContext\n): Promise<void> {\n context.debug(`Checking and installing missing project dependencies.`);\n\n context.dependencies ??= {};\n context.devDependencies ??= {};\n\n if (\n Object.keys(context.dependencies).length === 0 &&\n Object.keys(context.devDependencies).length === 0\n ) {\n context.debug(\n `No dependencies or devDependencies to install. Skipping installation step.`\n );\n return;\n }\n\n context.debug(\n `The following packages are required: \\nDependencies: \\n${Object.entries(\n context.dependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}\\n\\nDevDependencies: \\n${Object.entries(\n context.devDependencies\n )\n .map(([name, version]) => `- ${name}@${String(version)}`)\n .join(\" \\n\")}`\n );\n\n await Promise.all([\n Promise.all(\n Object.entries(context.dependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n false\n )\n )\n ),\n Promise.all(\n Object.entries(context.devDependencies).map(async ([name, version]) =>\n installPackage(\n context,\n `${getPackageName(name)}@${String(version)}`,\n true\n )\n )\n )\n ]);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { Diff, ObjectData } from \"@donedeal0/superdiff\";\nimport { getObjectDiff } from \"@donedeal0/superdiff\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport {\n findFileName,\n findFilePath,\n relativePath\n} from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { TsConfigJson } from \"@stryke/types/tsconfig\";\nimport chalk from \"chalk\";\nimport type { EnvironmentContext } from \"../../types\";\nimport { ResolvedConfig } from \"../../types\";\nimport {\n getParsedTypeScriptConfig,\n getTsconfigFilePath,\n isIncludeMatchFound\n} from \"../../typescript/tsconfig\";\n\nexport function getTsconfigDtsPath<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): string {\n const dtsRelativePath = joinPaths(\n relativePath(\n joinPaths(context.workspaceConfig.workspaceRoot, context.config.root),\n findFilePath(context.typesPath)\n ),\n findFileName(context.typesPath)\n );\n\n return dtsRelativePath;\n}\n\nasync function resolveTsconfigChanges<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>(context: EnvironmentContext<TResolvedConfig>): Promise<TsConfigJson> {\n const tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw\n );\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n const tsconfigJson = await readJsonFile<TsConfigJson>(tsconfigFilePath);\n tsconfigJson.compilerOptions ??= {};\n\n if (context.config.output.dts !== false) {\n const dtsRelativePath = getTsconfigDtsPath(context);\n\n if (\n !tsconfigJson.include?.some(filePattern =>\n isIncludeMatchFound(filePattern, [context.typesPath, dtsRelativePath])\n )\n ) {\n tsconfigJson.include ??= [];\n tsconfigJson.include.push(\n dtsRelativePath.startsWith(\"./\")\n ? dtsRelativePath.slice(2)\n : dtsRelativePath\n );\n }\n }\n\n if (\n !tsconfig.options.lib?.some(lib =>\n [\n \"lib.esnext.d.ts\",\n \"lib.es2021.d.ts\",\n \"lib.es2022.d.ts\",\n \"lib.es2023.d.ts\"\n ].includes(lib.toLowerCase())\n )\n ) {\n tsconfigJson.compilerOptions.lib ??= [];\n tsconfigJson.compilerOptions.lib.push(\"esnext\");\n }\n\n // if (tsconfig.options.module !== ts.ModuleKind.ESNext) {\n // tsconfigJson.compilerOptions.module = \"ESNext\";\n // }\n\n // if (\n // !tsconfig.options.target ||\n // ![\n // ts.ScriptTarget.ESNext,\n // ts.ScriptTarget.ES2024,\n // ts.ScriptTarget.ES2023,\n // ts.ScriptTarget.ES2022,\n // ts.ScriptTarget.ES2021\n // ].includes(tsconfig.options.target)\n // ) {\n // tsconfigJson.compilerOptions.target = \"ESNext\";\n // }\n\n // if (tsconfig.options.moduleResolution !== ts.ModuleResolutionKind.Bundler) {\n // tsconfigJson.compilerOptions.moduleResolution = \"Bundler\";\n // }\n\n // if (tsconfig.options.moduleDetection !== ts.ModuleDetectionKind.Force) {\n // tsconfigJson.compilerOptions.moduleDetection = \"force\";\n // }\n\n // if (tsconfig.options.allowSyntheticDefaultImports !== true) {\n // tsconfigJson.compilerOptions.allowSyntheticDefaultImports = true;\n // }\n\n // if (tsconfig.options.noImplicitOverride !== true) {\n // tsconfigJson.compilerOptions.noImplicitOverride = true;\n // }\n\n // if (tsconfig.options.noUncheckedIndexedAccess !== true) {\n // tsconfigJson.compilerOptions.noUncheckedIndexedAccess = true;\n // }\n\n // if (tsconfig.options.skipLibCheck !== true) {\n // tsconfigJson.compilerOptions.skipLibCheck = true;\n // }\n\n // if (tsconfig.options.resolveJsonModule !== true) {\n // tsconfigJson.compilerOptions.resolveJsonModule = true;\n // }\n\n // if (tsconfig.options.verbatimModuleSyntax !== false) {\n // tsconfigJson.compilerOptions.verbatimModuleSyntax = false;\n // }\n\n // if (tsconfig.options.allowJs !== true) {\n // tsconfigJson.compilerOptions.allowJs = true;\n // }\n\n // if (tsconfig.options.declaration !== true) {\n // tsconfigJson.compilerOptions.declaration = true;\n // }\n\n if (tsconfig.options.esModuleInterop !== true) {\n tsconfigJson.compilerOptions.esModuleInterop = true;\n }\n\n if (tsconfig.options.isolatedModules !== true) {\n tsconfigJson.compilerOptions.isolatedModules = true;\n }\n\n if (context.config.platform === \"node\") {\n if (\n !tsconfig.options.types?.some(\n type =>\n type.toLowerCase() === \"node\" || type.toLowerCase() === \"@types/node\"\n )\n ) {\n tsconfigJson.compilerOptions.types ??= [];\n tsconfigJson.compilerOptions.types.push(\"node\");\n }\n }\n\n return tsconfigJson;\n}\n\nexport async function initializeTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n context.debug(\n \"Initializing TypeScript configuration (tsconfig.json) for the Powerlines project.\"\n );\n\n if (!isPackageExists(\"typescript\")) {\n throw new Error(\n 'The TypeScript package is not installed. Please install the package using the command: \"npm install typescript --save-dev\"'\n );\n }\n\n const tsconfigFilePath = getTsconfigFilePath(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n\n context.tsconfig.originalTsconfigJson =\n await readJsonFile<TsConfigJson>(tsconfigFilePath);\n\n context.tsconfig.tsconfigJson =\n await resolveTsconfigChanges<TResolvedConfig>(context);\n\n context.debug(\n \"Writing updated TypeScript configuration (tsconfig.json) file to disk.\"\n );\n\n await context.fs.write(\n tsconfigFilePath,\n StormJSON.stringify(context.tsconfig.tsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig,\n context.config.tsconfigRaw,\n context.tsconfig.originalTsconfigJson\n );\n}\n\nexport async function resolveTsconfig<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TContext extends EnvironmentContext<TResolvedConfig> =\n EnvironmentContext<TResolvedConfig>\n>(context: TContext): Promise<void> {\n const updateTsconfigJson = await readJsonFile<TsConfigJson>(\n context.tsconfig.tsconfigFilePath\n );\n if (\n updateTsconfigJson?.compilerOptions?.types &&\n Array.isArray(updateTsconfigJson.compilerOptions.types) &&\n !updateTsconfigJson.compilerOptions.types.length\n ) {\n // If the types array is empty, we can safely remove it\n delete updateTsconfigJson.compilerOptions.types;\n }\n\n const result = getObjectDiff(\n context.tsconfig.originalTsconfigJson as NonNullable<ObjectData>,\n updateTsconfigJson as ObjectData,\n {\n ignoreArrayOrder: true,\n showOnly: {\n statuses: [\"added\", \"deleted\", \"updated\"],\n granularity: \"deep\"\n }\n }\n );\n\n const changes = [] as {\n field: string;\n status: \"added\" | \"deleted\" | \"updated\";\n previous: string;\n current: string;\n }[];\n const getChanges = (difference: Diff, property?: string) => {\n if (\n difference.status === \"added\" ||\n difference.status === \"deleted\" ||\n difference.status === \"updated\"\n ) {\n if (difference.diff) {\n for (const diff of difference.diff) {\n getChanges(\n diff,\n property\n ? `${property}.${difference.property}`\n : difference.property\n );\n }\n } else {\n changes.push({\n field: property\n ? `${property}.${difference.property}`\n : difference.property,\n status: difference.status,\n previous:\n difference.status === \"added\"\n ? \"---\"\n : StormJSON.stringify(difference.previousValue),\n current:\n difference.status === \"deleted\"\n ? \"---\"\n : StormJSON.stringify(difference.currentValue)\n });\n }\n }\n };\n\n for (const diff of result.diff) {\n getChanges(diff);\n }\n\n if (changes.length > 0) {\n context.warn(\n `Updating the following configuration values in \"${context.tsconfig.tsconfigFilePath}\" file:\n\n ${changes\n .map(\n (change, i) => `${chalk.bold.whiteBright(\n `${i + 1}. ${titleCase(change.status)} the ${change.field} field: `\n )}\n ${chalk.red(` - Previous: ${change.previous} `)}\n ${chalk.green(` - Updated: ${change.current} `)}\n `\n )\n .join(\"\\n\")}\n `\n );\n }\n\n await context.fs.write(\n context.tsconfig.tsconfigFilePath,\n StormJSON.stringify(updateTsconfigJson)\n );\n\n context.tsconfig = getParsedTypeScriptConfig(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.tsconfig\n );\n if (!context.tsconfig) {\n throw new Error(\"Failed to parse the TypeScript configuration file.\");\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { Unstable_APIContext } from \"@powerlines/core/types/_internal\";\nimport { formatLogMessage } from \"@storm-software/config-tools/logger/console\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { copyFiles } from \"@stryke/fs/copy-file\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { install } from \"@stryke/fs/install\";\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { isPackageExists } from \"@stryke/fs/package-fns\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { omit } from \"@stryke/helpers/omit\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isNumber } from \"@stryke/type-checks/is-number\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isPromiseLike } from \"@stryke/type-checks/is-promise\";\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 { MaybePromise, PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport chalk from \"chalk\";\nimport defu from \"defu\";\nimport Handlebars from \"handlebars\";\nimport packageJson from \"../package.json\" assert { type: \"json\" };\nimport {\n emitBuiltinTypes,\n formatTypes\n} from \"./_internal/helpers/generate-types\";\nimport { callHook, mergeConfigs } from \"./_internal/helpers/hooks\";\nimport { installDependencies } from \"./_internal/helpers/install-dependencies\";\nimport { writeMetaFile } from \"./_internal/helpers/meta\";\nimport {\n initializeTsconfig,\n resolveTsconfig\n} from \"./_internal/helpers/resolve-tsconfig\";\nimport { PowerlinesAPIContext } from \"./context/api-context\";\nimport {\n findInvalidPluginConfig,\n isDuplicate,\n isPlugin,\n isPluginConfig,\n isPluginConfigObject,\n isPluginConfigTuple\n} from \"./plugin-utils\";\nimport type {\n API,\n APIContext,\n BuildInlineConfig,\n CallHookOptions,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n EnvironmentContext,\n EnvironmentResolvedConfig,\n InferHookParameters,\n InitialUserConfig,\n LintInlineConfig,\n NewInlineConfig,\n Plugin,\n PluginConfig,\n PluginConfigObject,\n PluginConfigTuple,\n PluginContext,\n PluginFactory,\n PrepareInlineConfig,\n ResolvedConfig,\n TypesInlineConfig,\n TypesResult\n} from \"./types\";\nimport {\n colorText,\n format,\n formatFolder,\n getTypescriptFileHeader\n} from \"./utils\";\n\n/**\n * The Powerlines API class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesAPI<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n>\n implements API<TResolvedConfig>, AsyncDisposable\n{\n /**\n * The Powerlines context\n */\n #context: Unstable_APIContext<TResolvedConfig>;\n\n /**\n * The Powerlines context\n */\n public get context(): APIContext<TResolvedConfig> {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines API instance\n *\n * @param context - The Powerlines context\n */\n private constructor(context: APIContext<TResolvedConfig>) {\n this.#context = context as Unstable_APIContext<TResolvedConfig>;\n }\n\n /**\n * Initialize a Powerlines API instance\n *\n * @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in\n * @param config - An object containing the configuration required to run Powerlines tasks.\n * @returns A new instance of the Powerlines API\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig\n >(\n workspaceRoot: string,\n config: InitialUserConfig<TResolvedConfig[\"userConfig\"]>\n ): Promise<PowerlinesAPI<TResolvedConfig>> {\n const api = new PowerlinesAPI<TResolvedConfig>(\n await PowerlinesAPIContext.from(workspaceRoot, config)\n );\n\n api.#context.$$internal = {\n api,\n addPlugin: api.#addPlugin.bind(api)\n };\n\n const timer = api.context.timer(\"Initialization\");\n api.context.info(\n `🔌 The Powerlines Engine v${packageJson.version} has started`\n );\n\n for (const plugin of api.context.config.plugins.flat(10) ?? []) {\n await api.#addPlugin(plugin);\n }\n\n if (api.context.plugins.length === 0) {\n api.context.warn(\n \"No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.\"\n );\n } else {\n api.context.info(\n `Loaded ${api.context.plugins.length} ${titleCase(\n api.context.config.framework\n )} plugin${api.context.plugins.length > 1 ? \"s\" : \"\"}: \\n${api.context.plugins\n .map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`)\n .join(\"\\n\")}`\n );\n }\n\n const pluginConfig = await api.callHook(\"config\", {\n environment: await api.context.getEnvironment(),\n sequential: true,\n result: \"merge\",\n merge: mergeConfigs\n });\n await api.context.withUserConfig(\n pluginConfig as TResolvedConfig[\"userConfig\"],\n { isHighPriority: false }\n );\n\n timer();\n\n return api;\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(\n inlineConfig: PartialKeys<TypesInlineConfig, \"command\"> = {\n command: \"types\"\n }\n ) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\n \" 🏗️ Generating typescript declarations for the Powerlines project\"\n );\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"types\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<TypesInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n if (\n context.config.skipCache === true ||\n context.persistedMeta?.checksum !== context.meta.checksum\n ) {\n context.debug(\n `Using previously prepared files as the meta checksum has not changed.`\n );\n } else {\n context.info(\n `Running \\`prepare\\` command as the meta checksum has changed since the last run.`\n );\n\n await this.prepare(\n defu(\n {\n output: {\n types: false\n }\n },\n inlineConfig\n ) as PrepareInlineConfig<TResolvedConfig>\n );\n }\n\n await this.#types(context);\n\n this.context.debug(\"Formatting files generated during the types step.\");\n\n await format(\n context,\n context.typesPath,\n (await context.fs.read(context.typesPath)) ?? \"\"\n );\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\n \"✔ Powerlines types generation has completed successfully\"\n );\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PartialKeys<PrepareInlineConfig, \"command\">\n | PartialKeys<TypesInlineConfig, \"command\">\n | PartialKeys<NewInlineConfig, \"command\">\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\">\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<DocsInlineConfig, \"command\">\n | PartialKeys<DeployInlineConfig, \"command\"> = { command: \"prepare\" }\n ) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\" 🏗️ Preparing the Powerlines project\");\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"prepare\";\n\n await this.context.withInlineConfig(\n inlineConfig as RequiredKeys<PrepareInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n `Initializing the processing options for the Powerlines project.`\n );\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"pre\"\n });\n\n await initializeTsconfig<TResolvedConfig>(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.entry.length > 0) {\n context.debug(\n `The configuration provided ${\n isObject(context.config.input)\n ? Object.keys(context.config.input).length\n : toArray(context.config.input).length\n } entry point(s), Powerlines has found ${\n context.entry.length\n } entry files(s) for the ${context.config.title} project${\n context.entry.length > 0 && context.entry.length < 10\n ? `: \\n${context.entry\n .map(\n entry =>\n `- ${entry.file}${\n entry.output ? ` -> ${entry.output}` : \"\"\n }`\n )\n .join(\" \\n\")}`\n : \"\"\n }`\n );\n } else {\n context.warn(\n `No entry files were found for the ${\n context.config.title\n } project. Please ensure this is correct. Powerlines plugins generally require at least one entry point to function properly.`\n );\n }\n\n await resolveTsconfig<TResolvedConfig>(context);\n await installDependencies(context);\n\n await this.callHook(\"configResolved\", {\n environment: context,\n order: \"post\"\n });\n\n context.trace(\n `Powerlines configuration has been resolved: \\n\\n${formatLogMessage({\n ...context.config,\n userConfig: isSetObject(context.config.userConfig)\n ? omit(context.config.userConfig, [\"plugins\"])\n : undefined,\n inlineConfig: isSetObject(context.config.inlineConfig)\n ? omit(context.config.inlineConfig, [\"plugins\"])\n : undefined,\n plugins: context.plugins.map(plugin => plugin.plugin.name)\n })}`\n );\n\n if (!context.fs.existsSync(context.cachePath)) {\n await createDirectory(context.cachePath);\n }\n\n if (!context.fs.existsSync(context.dataPath)) {\n await createDirectory(context.dataPath);\n }\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"pre\"\n });\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"normal\"\n });\n\n await this.callHook(\"prepare\", {\n environment: context,\n order: \"post\"\n });\n\n if (context.config.output.types !== false) {\n await this.#types(context);\n }\n\n this.context.debug(\"Formatting files generated during the prepare step.\");\n\n await Promise.all([\n formatFolder(context, context.builtinsPath),\n formatFolder(context, context.entryPath)\n ]);\n\n await writeMetaFile(context);\n context.persistedMeta = context.meta;\n });\n\n this.context.debug(\"✔ Powerlines preparation has completed successfully\");\n timer();\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: PartialKeys<NewInlineConfig, \"command\">) {\n const timer = this.context.timer(\"New\");\n this.context.info(\" 🆕 Creating a new Powerlines project\");\n\n inlineConfig.command ??= \"new\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<NewInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Initializing the processing options for the Powerlines project.\"\n );\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"pre\"\n });\n\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/common/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding template file to project: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.projectType === \"application\") {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/application/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding application template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n } else {\n const files = await listFiles(\n joinPaths(context.powerlinesPath, \"files/library/**/*.hbs\")\n );\n for (const file of files) {\n context.trace(`Adding library template file: ${file}`);\n\n const template = Handlebars.compile(file);\n await context.fs.write(\n joinPaths(context.config.root, file.replace(\".hbs\", \"\")),\n template(context)\n );\n }\n }\n\n await this.callHook(\"new\", {\n environment: context,\n order: \"post\"\n });\n });\n\n this.context.debug(\"✔ Powerlines new command completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig:\n | PartialKeys<CleanInlineConfig, \"command\">\n | PartialKeys<PrepareInlineConfig, \"command\"> = {\n command: \"clean\"\n }\n ) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\" 🧹 Cleaning the previous Powerlines artifacts\");\n\n inlineConfig.command ??= \"clean\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<CleanInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\"Cleaning the project's dist and artifacts directories.\");\n\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.path\n )\n );\n await context.fs.remove(\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n context.config.output.artifactsPath\n )\n );\n\n await this.callHook(\"clean\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig:\n | PartialKeys<LintInlineConfig, \"command\">\n | PartialKeys<BuildInlineConfig, \"command\"> = { command: \"lint\" }\n ) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\" 📝 Linting the Powerlines project\");\n\n inlineConfig.command ??= \"lint\";\n await this.prepare(\n inlineConfig as RequiredKeys<LintInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"lint\", {\n environment: context,\n sequential: false\n });\n });\n\n this.context.debug(\"✔ Powerlines linting completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(\n inlineConfig: PartialKeys<BuildInlineConfig, \"command\"> = {\n command: \"build\"\n }\n ) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\" 📦 Building the Powerlines project\");\n\n await this.context.generateChecksum();\n if (\n this.context.meta.checksum !== this.context.persistedMeta?.checksum ||\n this.context.config.skipCache\n ) {\n this.context.info(\n !this.context.persistedMeta?.checksum\n ? \"No previous build cache found. Preparing the project for the initial build.\"\n : this.context.meta.checksum !== this.context.persistedMeta.checksum\n ? \"The project has been modified since the last time `prepare` was ran. Re-preparing the project.\"\n : \"The project is configured to skip cache. Re-preparing the project.\"\n );\n\n inlineConfig.command ??= \"build\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<BuildInlineConfig, \"command\">\n );\n }\n\n if (this.context.config.singleBuild) {\n await this.#handleBuild(await this.#context.toEnvironment());\n } else {\n await this.#executeEnvironments(async context => {\n await this.#handleBuild(context);\n });\n }\n\n this.context.debug(\"✔ Powerlines build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(inlineConfig: DocsInlineConfig = { command: \"docs\" }) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\n \" 📓 Generating documentation for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"docs\";\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n context.debug(\n \"Writing documentation for the Powerlines project artifacts.\"\n );\n\n inlineConfig.command ??= \"docs\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DocsInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"docs\", {\n environment: context\n });\n });\n });\n\n this.context.debug(\n \"✔ Powerlines documentation generation completed successfully\"\n );\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: PartialKeys<DeployInlineConfig, \"command\"> = {\n command: \"deploy\"\n }\n ) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\" 🚀 Deploying the Powerlines project\");\n\n inlineConfig.command ??= \"deploy\";\n\n await this.prepare(\n inlineConfig as RequiredKeys<DeployInlineConfig, \"command\">\n );\n await this.#executeEnvironments(async context => {\n await this.callHook(\"deploy\", { environment: context });\n });\n\n this.context.debug(\"✔ Powerlines deploy completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalization\");\n this.context.info(\" 🏁 Powerlines finalization processes started\");\n\n await this.#executeEnvironments(async context => {\n await this.callHook(\"finalize\", { environment: context });\n await context.fs.dispose();\n\n if (\n existsSync(context.cachePath) &&\n !(await listFiles(joinPaths(context.cachePath, \"**/*\")))?.length\n ) {\n await removeDirectory(context.cachePath);\n }\n });\n\n this.context.debug(\"✔ Powerlines finalization completed successfully\");\n timer();\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 async callHook<TKey extends string>(\n hook: TKey,\n options: CallHookOptions & {\n environment?: string | EnvironmentContext<TResolvedConfig>;\n },\n ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey>\n ) {\n return callHook<TResolvedConfig, TKey>(\n isSetObject(options?.environment)\n ? options.environment\n : await this.#context.getEnvironment(options?.environment),\n hook,\n { sequential: true, ...options },\n ...args\n );\n }\n\n /**\n * Dispose of the Powerlines API instance\n *\n * @remarks\n * This method will finalize the Powerlines API instance, cleaning up any resources used.\n */\n public async [Symbol.asyncDispose]() {\n await this.finalize();\n }\n\n async #handleBuild(context: EnvironmentContext<TResolvedConfig>) {\n await this.callHook(\"build\", {\n environment: context,\n order: \"pre\"\n });\n\n context.debug(\n \"Formatting the generated entry files before the build process starts.\"\n );\n await formatFolder(context, context.entryPath);\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"normal\"\n });\n\n if (context.config.output.copy) {\n context.debug(\"Copying project's files from build output directory.\");\n\n const destinationPath = isParentPath(\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(context.config.root, context.workspaceConfig.workspaceRoot)\n )\n ? joinPaths(\n context.config.output.copy.path,\n relativePath(\n appendPath(\n context.config.root,\n context.workspaceConfig.workspaceRoot\n ),\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : joinPaths(context.config.output.copy.path, \"dist\");\n const sourcePath = appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n );\n\n if (existsSync(sourcePath) && sourcePath !== destinationPath) {\n context.debug(\n `Copying files from project's build output directory (${\n context.config.output.path\n }) to the project's copy/publish directory (${destinationPath}).`\n );\n\n await copyFiles(sourcePath, destinationPath);\n } else {\n context.warn(\n `The source path for the copy operation ${\n !existsSync(sourcePath)\n ? \"does not exist\"\n : \"is the same as the destination path\"\n }. Source: ${sourcePath}, Destination: ${\n destinationPath\n }. Skipping copying of build output files.`\n );\n }\n\n if (\n context.config.output.copy.assets &&\n Array.isArray(context.config.output.copy.assets)\n ) {\n await Promise.all(\n context.config.output.copy.assets.map(async asset => {\n context.trace(\n `Copying asset(s): ${chalk.redBright(\n context.workspaceConfig.workspaceRoot === asset.input\n ? asset.glob\n : appendPath(\n asset.glob,\n replacePath(\n asset.input,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} -> ${chalk.greenBright(\n appendPath(\n asset.glob,\n replacePath(\n asset.output,\n context.workspaceConfig.workspaceRoot\n )\n )\n )} ${\n Array.isArray(asset.ignore) && asset.ignore.length > 0\n ? ` (ignoring: ${asset.ignore\n .map(i => chalk.yellowBright(i))\n .join(\", \")})`\n : \"\"\n }`\n );\n\n await context.fs.copy(asset, asset.output);\n })\n );\n }\n } else {\n context.debug(\n \"No copy configuration found for the project output. Skipping the copying of build output files.\"\n );\n }\n\n await this.callHook(\"build\", {\n environment: context,\n order: \"post\"\n });\n }\n\n /**\n * Get the configured environments\n *\n * @returns The configured environments\n */\n async #getEnvironments() {\n if (\n !this.context.config.environments ||\n Object.keys(this.context.config.environments).length <= 1\n ) {\n this.context.debug(\n \"No environments are configured for this Powerlines project. Using the default environment.\"\n );\n\n return [await this.context.getEnvironment()];\n }\n\n this.context.debug(\n `Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`\n );\n\n return (\n await Promise.all(\n Object.entries(this.context.config.environments).map(\n async ([name, config]) => {\n const environment = await this.context.getEnvironmentSafe(name);\n if (!environment) {\n const resolvedEnvironment = await this.callHook(\n \"configEnvironment\",\n {\n environment: name\n },\n name,\n config\n );\n\n if (resolvedEnvironment) {\n this.context.environments[name] = await this.context.in(\n resolvedEnvironment as EnvironmentResolvedConfig\n );\n }\n }\n\n return this.context.environments[name];\n }\n )\n )\n ).filter(context => isSet(context));\n }\n\n /**\n * Execute a handler function for each environment\n *\n * @param handle - The handler function to execute for each environment\n */\n async #executeEnvironments(\n handle: (context: EnvironmentContext<TResolvedConfig>) => MaybePromise<void>\n ) {\n await Promise.all(\n (await this.#getEnvironments()).map(async context => {\n return Promise.resolve(handle(context));\n })\n );\n }\n\n /**\n * Add a Powerlines plugin used in the build process\n *\n * @param config - The import path of the plugin to add\n */\n async #addPlugin(config: PluginConfig<PluginContext<TResolvedConfig>>) {\n if (config) {\n const result = await this.#initPlugin(config);\n if (!result) {\n return;\n }\n\n for (const plugin of result) {\n this.context.debug(\n `Successfully initialized the ${chalk.bold.cyanBright(\n plugin.name\n )} plugin`\n );\n\n await this.context.addPlugin(plugin);\n }\n }\n }\n\n /**\n * Initialize a Powerlines plugin\n *\n * @param config - The configuration for the plugin\n * @returns The initialized plugin instance, or null if the plugin was a duplicate\n * @throws Will throw an error if the plugin cannot be found or is invalid\n */\n async #initPlugin(\n config: PluginConfig<PluginContext<TResolvedConfig>>\n ): Promise<Plugin<PluginContext<TResolvedConfig>>[] | null> {\n let awaited = config;\n if (isPromiseLike(config)) {\n awaited = (await Promise.resolve(config as Promise<any>)) as PluginConfig<\n PluginContext<TResolvedConfig>\n >;\n }\n\n if (!isPluginConfig<PluginContext<TResolvedConfig>>(awaited)) {\n const invalid = findInvalidPluginConfig(awaited);\n\n throw new Error(\n `Invalid ${\n invalid && invalid.length > 1 ? \"plugins\" : \"plugin\"\n } specified in the configuration - ${\n invalid && invalid.length > 0\n ? JSON.stringify(awaited)\n : invalid?.join(\"\\n\\n\")\n } \\n\\nPlease ensure the value is one of the following: \\n - an instance of \\`Plugin\\` \\n - a plugin name \\n - an object with the \\`plugin\\` and \\`options\\` properties \\n - a tuple array with the plugin and options \\n - a factory function that returns a plugin or array of plugins \\n - an array of plugins or plugin configurations`\n );\n }\n\n let plugins!: Plugin<PluginContext<TResolvedConfig>>[];\n if (isPlugin<PluginContext<TResolvedConfig>>(awaited)) {\n plugins = [awaited];\n } else if (isFunction(awaited)) {\n plugins = toArray(await Promise.resolve(awaited()));\n } else if (isString(awaited)) {\n const resolved = await this.#resolvePlugin(awaited);\n if (isFunction(resolved)) {\n plugins = toArray(await Promise.resolve(resolved()));\n } else {\n plugins = toArray(resolved);\n }\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginContext<TResolvedConfig>[]).every(\n isPlugin<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = awaited as Plugin<PluginContext<TResolvedConfig>>[];\n } else if (\n Array.isArray(awaited) &&\n (awaited as PluginConfig<PluginContext<TResolvedConfig>>[]).every(\n isPluginConfig<PluginContext<TResolvedConfig>>\n )\n ) {\n plugins = [];\n for (const pluginConfig of awaited as PluginConfig<\n PluginContext<TResolvedConfig>\n >[]) {\n const initialized = await this.#initPlugin(pluginConfig);\n if (initialized) {\n plugins.push(...initialized);\n }\n }\n } else if (\n isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited) ||\n isPluginConfigObject<PluginContext<TResolvedConfig>>(awaited)\n ) {\n let pluginConfig!:\n | string\n | PluginFactory<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>;\n let pluginOptions: any;\n\n if (isPluginConfigTuple<PluginContext<TResolvedConfig>>(awaited)) {\n pluginConfig = awaited[0] as Plugin<PluginContext<TResolvedConfig>>;\n pluginOptions =\n (awaited as PluginConfigTuple)?.length === 2 ? awaited[1] : undefined;\n } else {\n pluginConfig = (awaited as PluginConfigObject).plugin as Plugin<\n PluginContext<TResolvedConfig>\n >;\n pluginOptions = (awaited as PluginConfigObject).options;\n }\n\n if (isSetString(pluginConfig)) {\n const resolved = await this.#resolvePlugin(pluginConfig);\n if (isFunction(resolved)) {\n plugins = toArray(\n await Promise.resolve(\n pluginOptions ? resolved(pluginOptions) : resolved()\n )\n );\n } else {\n plugins = toArray(resolved);\n }\n } else if (isFunction(pluginConfig)) {\n plugins = toArray(await Promise.resolve(pluginConfig(pluginOptions)));\n } else if (\n Array.isArray(pluginConfig) &&\n pluginConfig.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n plugins = pluginConfig;\n } else if (isPlugin<PluginContext<TResolvedConfig>>(pluginConfig)) {\n plugins = toArray(pluginConfig);\n }\n }\n\n if (!plugins) {\n throw new Error(\n `The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n if (\n plugins.length > 0 &&\n !plugins.every(isPlugin<PluginContext<TResolvedConfig>>)\n ) {\n throw new Error(\n `The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`\n );\n }\n\n const result = [] as Plugin<PluginContext<TResolvedConfig>>[];\n for (const plugin of plugins) {\n if (isDuplicate<TResolvedConfig>(plugin, this.context.plugins)) {\n this.context.trace(\n `Duplicate ${chalk.bold.cyanBright(\n plugin.name\n )} plugin dependency detected - Skipping initialization.`\n );\n } else {\n result.push(plugin);\n\n this.context.trace(\n `Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`\n );\n }\n }\n\n return result;\n }\n\n async #resolvePlugin<TOptions>(\n pluginPath: string\n ): Promise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n | ((\n options?: TOptions\n ) => MaybePromise<\n | Plugin<PluginContext<TResolvedConfig>>\n | Plugin<PluginContext<TResolvedConfig>>[]\n >)\n > {\n if (\n pluginPath.startsWith(\"@\") &&\n pluginPath.split(\"/\").filter(Boolean).length > 2\n ) {\n const splits = pluginPath.split(\"/\").filter(Boolean);\n pluginPath = `${splits[0]}/${splits[1]}`;\n }\n\n const isInstalled = isPackageExists(pluginPath, {\n paths: [\n this.context.workspaceConfig.workspaceRoot,\n this.context.config.root\n ]\n });\n if (!isInstalled && this.context.config.autoInstall) {\n this.#context.warn(\n `The plugin package \"${\n pluginPath\n }\" is not installed. It will be installed automatically.`\n );\n\n const result = await install(pluginPath, {\n cwd: this.context.config.root\n });\n if (isNumber(result.exitCode) && result.exitCode > 0) {\n this.#context.error(result.stderr);\n\n throw new Error(\n `An error occurred while installing the build plugin package \"${\n pluginPath\n }\" `\n );\n }\n }\n\n try {\n // First check if the package has a \"plugin\" subdirectory - @scope/package/plugin\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(\n this.context.resolver.plugin.esmResolve(joinPaths(pluginPath, \"plugin\"))\n );\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch (error) {\n try {\n const module = await this.context.resolver.plugin.import<{\n plugin?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n default?:\n | Plugin<PluginContext<TResolvedConfig>>\n | ((\n options?: TOptions\n ) => MaybePromise<Plugin<PluginContext<TResolvedConfig>>>);\n }>(this.context.resolver.plugin.esmResolve(pluginPath));\n\n const result = module.plugin ?? module.default;\n if (!result) {\n throw new Error(\n `The plugin package \"${pluginPath}\" does not export a valid module.`\n );\n }\n\n return result;\n } catch {\n if (!isInstalled) {\n throw new Error(\n `The plugin package \"${\n pluginPath\n }\" is not installed. Please install the package using the command: \"npm install ${\n pluginPath\n } --save-dev\"`\n );\n } else {\n throw new Error(\n `An error occurred while importing the build plugin package \"${\n pluginPath\n }\":\n${isError(error) ? error.message : String(error)}\n\nNote: Please ensure the plugin package's default export is a class that extends \\`Plugin\\` with a constructor that excepts a single arguments of type \\`PluginOptions\\`.`\n );\n }\n }\n }\n }\n\n /**\n * Generate the Powerlines TypeScript declaration file\n *\n * @remarks\n * This method will generate the TypeScript declaration file for the Powerlines project, including any types provided by plugins.\n *\n * @param context - The environment context to use for generating the TypeScript declaration file\n * @returns A promise that resolves when the TypeScript declaration file has been generated\n */\n async #types(context: EnvironmentContext<TResolvedConfig>) {\n context.debug(\n `Preparing the TypeScript definitions for the Powerlines project.`\n );\n\n if (context.fs.existsSync(context.typesPath)) {\n await context.fs.remove(context.typesPath);\n }\n\n const typescriptPath = await resolvePackage(\"typescript\");\n if (!typescriptPath) {\n throw new Error(\n \"Could not resolve TypeScript package location. Please ensure TypeScript is installed.\"\n );\n }\n\n context.debug(\n \"Running TypeScript compiler for built-in runtime module files.\"\n );\n\n let { code, directives } = await emitBuiltinTypes(\n context,\n (await context.getBuiltins()).reduce<string[]>((ret, builtin) => {\n const formatted = replacePath(\n builtin.path,\n context.workspaceConfig.workspaceRoot\n );\n if (!ret.includes(formatted)) {\n ret.push(formatted);\n }\n\n return ret;\n }, [])\n );\n\n context.debug(\n `Generating TypeScript declaration file ${context.typesPath}.`\n );\n\n const merge = async (\n currentResult: string | TypesResult,\n previousResult: string | TypesResult\n ): Promise<string | TypesResult> => {\n if (\n !isSetString(currentResult) &&\n !isSetObject(currentResult) &&\n !isSetString(previousResult) &&\n !isSetObject(previousResult)\n ) {\n return { code, directives };\n }\n\n const previous = (\n await format(\n context,\n context.typesPath,\n isSetString(previousResult)\n ? previousResult\n : isSetObject(previousResult)\n ? previousResult.code\n : \"\"\n )\n )\n .trim()\n .replace(code, \"\")\n .trim();\n const current = (\n await format(\n context,\n context.typesPath,\n isSetString(currentResult)\n ? currentResult\n : isSetObject(currentResult)\n ? currentResult.code\n : \"\"\n )\n )\n .trim()\n .replace(previous, \"\")\n .trim()\n .replace(code, \"\")\n .trim();\n\n return {\n directives: [\n ...(isSetObject(currentResult) && currentResult.directives\n ? currentResult.directives\n : []),\n ...(isSetObject(previousResult) && previousResult.directives\n ? previousResult.directives\n : [])\n ],\n code: await format(\n context,\n context.typesPath,\n `${\n !previous.includes(getTypescriptFileHeader(context)) &&\n !current.includes(getTypescriptFileHeader(context))\n ? `${code}\\n`\n : \"\"\n }${previous}\\n${current}`.trim()\n )\n };\n };\n const asNextParam = (\n previousResult: string | TypesResult | null | undefined\n ) => (isObject(previousResult) ? previousResult.code : previousResult);\n\n let result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"pre\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"normal\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n result = await this.callHook(\n \"types\",\n {\n environment: context,\n sequential: true,\n order: \"post\",\n result: \"merge\",\n merge,\n asNextParam\n },\n code\n );\n if (result) {\n if (isSetObject(result)) {\n code = result.code;\n if (Array.isArray(result.directives) && result.directives.length > 0) {\n directives = getUnique([...directives, ...result.directives]).filter(\n Boolean\n );\n }\n } else if (isSetString(result)) {\n code = result;\n }\n }\n\n if (isSetString(code?.trim()) || directives.length > 0) {\n await context.fs.write(\n context.typesPath,\n `${\n directives.length > 0\n ? `${directives.map(directive => `/// <reference types=\"${directive}\" />`).join(\"\\n\")}\n\n`\n : \"\"\n }${getTypescriptFileHeader(context, { directive: null, prettierIgnore: false })}\n\n${formatTypes(code)}\n`\n );\n }\n\n // else {\n // const dtsRelativePath = getTsconfigDtsPath(context);\n // if (\n // context.tsconfig.tsconfigJson.include &&\n // isIncludeMatchFound(\n // dtsRelativePath,\n // context.tsconfig.tsconfigJson.include\n // )\n // ) {\n // const normalizedDtsRelativePath = dtsRelativePath.startsWith(\"./\")\n // ? dtsRelativePath.slice(2)\n // : dtsRelativePath;\n // context.tsconfig.tsconfigJson.include =\n // context.tsconfig.tsconfigJson.include.filter(\n // includeValue =>\n // includeValue?.toString() !== normalizedDtsRelativePath\n // );\n\n // await context.fs.write(\n // context.tsconfig.tsconfigFilePath,\n // JSON.stringify(context.tsconfig.tsconfigJson, null, 2)\n // );\n // }\n // }\n\n // // Re-resolve the tsconfig to ensure it is up to date\n // context.tsconfig = getParsedTypeScriptConfig(\n // context.workspaceConfig.workspaceRoot,\n // context.config.root,\n // context.config.tsconfig\n // );\n // if (!context.tsconfig) {\n // throw new Error(\"Failed to parse the TypeScript configuration file.\");\n // }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC6EA,SAAgB,YAAY,OAAO,IAAY;AAC7C,QAAO,KAAK,WAAW,aAAa,GAAG,CAAC,QAAQ,QAAQ,GAAG;;AAG7D,eAAe,0BACb,KACA,UACA,MACA,MAC4B;CAC5B,MAAM,UAAmC,EAAE;CAC3C,MAAM,UAA8C,EAAE;CAEtD,MAAM,UAAU,KACb,MACC,IAAI,OACF,+BACE,IAAI,QAAQ,OAAO,UACpB,GAAG,KAAK,oBACV,CACF,EACC,MAAK,YAAW,YAAY,S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AAC,OAC5D,QACD;cAEM,YAAY,OAAO,CAC5B,QAAO;;AAIX,MAAI,YAAY,MAAM,MAAM,CAAC,IAAI,WAAW,SAAS,EACnD,OAAM,QAAQ,GAAG,MACf,QAAQ,WACR,GACE,WAAW,SAAS,IAChB,GAAG,WAAW,KAAI,cAAa,yBAAyB,UAAU,MAAM,CAAC,KAAK,KAAK,CAAC;;IAGpF,gDACqB,SAAS;GAAE,WAAW;GAAM,gBAAgB;GAAO,CAAC,CAAC;;EAEtF,YAAY,KAAK,CAAC;EAEb"}
@@ -1,9 +1,9 @@
1
1
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
- const require_ts_morph = require('./ts-morph-Cf4wz3E0.cjs');
2
+ const require_ts_morph = require('./ts-morph-BvE8TMhv.cjs');
3
3
  const require_utils = require('./utils.cjs');
4
4
  const require_plugin_utils = require('./plugin-utils.cjs');
5
- const require_api_context = require('./api-context-BBKp6Qh3.cjs');
6
- const require_tsconfig = require('./tsconfig-ChmbpAO7.cjs');
5
+ const require_api_context = require('./api-context-g8U0DTyF.cjs');
6
+ const require_tsconfig = require('./tsconfig-BjkktvB9.cjs');
7
7
  let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
8
8
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
9
9
  let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
@@ -31,11 +31,11 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
31
31
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
32
32
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
33
33
  let chalk = require("chalk");
34
- chalk = require_chunk.__toESM(chalk);
34
+ chalk = require_chunk.__toESM(chalk, 1);
35
35
  let defu = require("defu");
36
- defu = require_chunk.__toESM(defu);
36
+ defu = require_chunk.__toESM(defu, 1);
37
37
  let handlebars = require("handlebars");
38
- handlebars = require_chunk.__toESM(handlebars);
38
+ handlebars = require_chunk.__toESM(handlebars, 1);
39
39
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
40
40
  let ts_morph = require("ts-morph");
41
41
  let _stryke_string_format_package = require("@stryke/string-format/package");
@@ -45,7 +45,7 @@ let _stryke_json_storm_json = require("@stryke/json/storm-json");
45
45
 
46
46
  //#region package.json
47
47
  var name = "powerlines";
48
- var version = "0.42.38";
48
+ var version = "0.42.39";
49
49
 
50
50
  //#endregion
51
51
  //#region src/_internal/helpers/generate-types.ts
@@ -2,7 +2,7 @@ const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
2
  const require_utils = require('./utils.cjs');
3
3
  const require_plugin_utils = require('./plugin-utils.cjs');
4
4
  const require_constants = require('./constants.cjs');
5
- const require_tsconfig = require('./tsconfig-ChmbpAO7.cjs');
5
+ const require_tsconfig = require('./tsconfig-BjkktvB9.cjs');
6
6
  const require_config = require('./config.cjs');
7
7
  const require_virtual = require('./virtual-BNy8T32w.cjs');
8
8
  let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
@@ -24,9 +24,9 @@ let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-obje
24
24
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
25
25
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
26
26
  let chalk = require("chalk");
27
- chalk = require_chunk.__toESM(chalk);
27
+ chalk = require_chunk.__toESM(chalk, 1);
28
28
  let defu = require("defu");
29
- defu = require_chunk.__toESM(defu);
29
+ defu = require_chunk.__toESM(defu, 1);
30
30
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
31
31
  let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
32
32
  let _stryke_helpers_get_field = require("@stryke/helpers/get-field");
@@ -51,7 +51,7 @@ let oxc_parser = require("oxc-parser");
51
51
  let undici = require("undici");
52
52
  let jiti = require("jiti");
53
53
  let _stryke_capnp = require("@stryke/capnp");
54
- _stryke_capnp = require_chunk.__toESM(_stryke_capnp);
54
+ _stryke_capnp = require_chunk.__toESM(_stryke_capnp, 1);
55
55
  let _stryke_fs_buffer = require("@stryke/fs/buffer");
56
56
  let _stryke_path_correct_path = require("@stryke/path/correct-path");
57
57
  let _stryke_path_glob_to_regex = require("@stryke/path/glob-to-regex");
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_api_context = require('../api-context-BBKp6Qh3.cjs');
2
+ const require_api_context = require('../api-context-g8U0DTyF.cjs');
3
3
 
4
4
  exports.PowerlinesAPIContext = require_api_context.PowerlinesAPIContext;
5
5
  exports.PowerlinesContext = require_api_context.PowerlinesContext;
package/dist/esbuild.cjs CHANGED
@@ -5,7 +5,7 @@ let unplugin = require("unplugin");
5
5
  let _powerlines_plugin_esbuild_helpers_resolve_options = require("@powerlines/plugin-esbuild/helpers/resolve-options");
6
6
  let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
7
7
  let _powerlines_plugin_esbuild = require("@powerlines/plugin-esbuild");
8
- _powerlines_plugin_esbuild = require_chunk.__toESM(_powerlines_plugin_esbuild);
8
+ _powerlines_plugin_esbuild = require_chunk.__toESM(_powerlines_plugin_esbuild, 1);
9
9
 
10
10
  //#region src/esbuild.ts
11
11
  /**
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
- const require_api = require('./api-vm8Sg9Oo.cjs');
4
- const require_api_context = require('./api-context-BBKp6Qh3.cjs');
3
+ const require_api = require('./api-XaP3Nf6H.cjs');
4
+ const require_api_context = require('./api-context-g8U0DTyF.cjs');
5
5
  let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
6
6
 
7
7
  //#region src/index.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesAPI } from "./api-BrPeHPR6.mjs";
1
+ import { t as PowerlinesAPI } from "./api-ObH5-iUb.mjs";
2
2
  import { a as FileId, c as FileStorage, l as FileSystem, o as FileMetadata, s as FileMetadata_KeyValuePair, u as _capnpFileId } from "./api-context-DuZIIJsm.mjs";
3
3
  import { getWorkspaceRoot } from "@stryke/fs/get-workspace-root";
4
4
 
package/dist/nuxt.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
- const require_api = require('./api-vm8Sg9Oo.cjs');
3
+ const require_api = require('./api-XaP3Nf6H.cjs');
4
4
  const require_vite = require('./vite.cjs');
5
5
  const require_webpack = require('./webpack.cjs');
6
6
  let _nuxt_kit = require("@nuxt/kit");
package/dist/nuxt.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as name, r as version } from "./api-BrPeHPR6.mjs";
1
+ import { n as name, r as version } from "./api-ObH5-iUb.mjs";
2
2
  import { unplugin as unplugin$1 } from "./vite.mjs";
3
3
  import { unplugin as unplugin$2 } from "./webpack.mjs";
4
4
  import { addVitePlugin, addWebpackPlugin, defineNuxtModule } from "@nuxt/kit";
package/dist/rolldown.cjs CHANGED
@@ -5,7 +5,7 @@ let defu = require("defu");
5
5
  let unplugin = require("unplugin");
6
6
  let _powerlines_plugin_rolldown_helpers_resolve_options = require("@powerlines/plugin-rolldown/helpers/resolve-options");
7
7
  let _powerlines_plugin_rolldown = require("@powerlines/plugin-rolldown");
8
- _powerlines_plugin_rolldown = require_chunk.__toESM(_powerlines_plugin_rolldown);
8
+ _powerlines_plugin_rolldown = require_chunk.__toESM(_powerlines_plugin_rolldown, 1);
9
9
 
10
10
  //#region src/rolldown.ts
11
11
  /**
package/dist/rollup.cjs CHANGED
@@ -3,7 +3,7 @@ const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
3
  const require_unplugin = require('./unplugin.cjs');
4
4
  let unplugin = require("unplugin");
5
5
  let _powerlines_plugin_rollup = require("@powerlines/plugin-rollup");
6
- _powerlines_plugin_rollup = require_chunk.__toESM(_powerlines_plugin_rollup);
6
+ _powerlines_plugin_rollup = require_chunk.__toESM(_powerlines_plugin_rollup, 1);
7
7
 
8
8
  //#region src/rollup.ts
9
9
  /**
package/dist/rspack.cjs CHANGED
@@ -3,7 +3,7 @@ const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
3
  const require_unplugin = require('./unplugin.cjs');
4
4
  let unplugin = require("unplugin");
5
5
  let _powerlines_plugin_rspack = require("@powerlines/plugin-rspack");
6
- _powerlines_plugin_rspack = require_chunk.__toESM(_powerlines_plugin_rspack);
6
+ _powerlines_plugin_rspack = require_chunk.__toESM(_powerlines_plugin_rspack, 1);
7
7
 
8
8
  //#region src/rspack.ts
9
9
  /**
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
2
  let defu = require("defu");
3
- defu = require_chunk.__toESM(defu);
3
+ defu = require_chunk.__toESM(defu, 1);
4
4
  let ts_morph = require("ts-morph");
5
5
 
6
6
  //#region src/typescript/ts-morph.ts
@@ -3,10 +3,10 @@ let _stryke_fs_exists = require("@stryke/fs/exists");
3
3
  let _stryke_path_append = require("@stryke/path/append");
4
4
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
5
5
  let defu = require("defu");
6
- defu = require_chunk.__toESM(defu);
6
+ defu = require_chunk.__toESM(defu, 1);
7
7
  let _stryke_fs_json = require("@stryke/fs/json");
8
8
  let typescript = require("typescript");
9
- typescript = require_chunk.__toESM(typescript);
9
+ typescript = require_chunk.__toESM(typescript, 1);
10
10
 
11
11
  //#region src/typescript/tsconfig.ts
12
12
  /**
package/dist/tsdown.cjs CHANGED
@@ -6,7 +6,7 @@ let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function")
6
6
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
7
7
  let _powerlines_plugin_tsdown_helpers_resolve_options = require("@powerlines/plugin-tsdown/helpers/resolve-options");
8
8
  let _powerlines_plugin_tsdown = require("@powerlines/plugin-tsdown");
9
- _powerlines_plugin_tsdown = require_chunk.__toESM(_powerlines_plugin_tsdown);
9
+ _powerlines_plugin_tsdown = require_chunk.__toESM(_powerlines_plugin_tsdown, 1);
10
10
 
11
11
  //#region src/tsdown.ts
12
12
  /**
package/dist/tsup.cjs CHANGED
@@ -4,7 +4,7 @@ const require_esbuild = require('./esbuild.cjs');
4
4
  let _stryke_helpers_omit = require("@stryke/helpers/omit");
5
5
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
6
6
  let _powerlines_plugin_tsup = require("@powerlines/plugin-tsup");
7
- _powerlines_plugin_tsup = require_chunk.__toESM(_powerlines_plugin_tsup);
7
+ _powerlines_plugin_tsup = require_chunk.__toESM(_powerlines_plugin_tsup, 1);
8
8
 
9
9
  //#region src/tsup.ts
10
10
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_ts_morph = require('../ts-morph-Cf4wz3E0.cjs');
3
- const require_tsconfig = require('../tsconfig-ChmbpAO7.cjs');
2
+ const require_ts_morph = require('../ts-morph-BvE8TMhv.cjs');
3
+ const require_tsconfig = require('../tsconfig-BjkktvB9.cjs');
4
4
 
5
5
  exports.VirtualFileSystemHost = require_ts_morph.VirtualFileSystemHost;
6
6
  exports.createProgram = require_ts_morph.createProgram;
package/dist/unplugin.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
- const require_api = require('./api-vm8Sg9Oo.cjs');
3
+ const require_api = require('./api-XaP3Nf6H.cjs');
4
4
  let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
5
5
  let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
6
6
  let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
package/dist/unplugin.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesAPI } from "./api-BrPeHPR6.mjs";
1
+ import { t as PowerlinesAPI } from "./api-ObH5-iUb.mjs";
2
2
  import { getWorkspaceRoot } from "@stryke/fs/get-workspace-root";
3
3
  import { createLog } from "@powerlines/core/lib/logger";
4
4
  import { LogLevelLabel } from "@storm-software/config-tools/types";
package/dist/vite.cjs CHANGED
@@ -2,12 +2,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
3
  const require_unplugin = require('./unplugin.cjs');
4
4
  let defu = require("defu");
5
- defu = require_chunk.__toESM(defu);
5
+ defu = require_chunk.__toESM(defu, 1);
6
6
  let _powerlines_plugin_vite_helpers_resolve_options = require("@powerlines/plugin-vite/helpers/resolve-options");
7
7
  let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
8
8
  let unplugin = require("unplugin");
9
9
  let _powerlines_plugin_vite = require("@powerlines/plugin-vite");
10
- _powerlines_plugin_vite = require_chunk.__toESM(_powerlines_plugin_vite);
10
+ _powerlines_plugin_vite = require_chunk.__toESM(_powerlines_plugin_vite, 1);
11
11
 
12
12
  //#region src/vite.ts
13
13
  /**
package/dist/webpack.cjs CHANGED
@@ -3,7 +3,7 @@ const require_chunk = require('./chunk-AIJqnxB6.cjs');
3
3
  const require_unplugin = require('./unplugin.cjs');
4
4
  let unplugin = require("unplugin");
5
5
  let _powerlines_plugin_webpack = require("@powerlines/plugin-webpack");
6
- _powerlines_plugin_webpack = require_chunk.__toESM(_powerlines_plugin_webpack);
6
+ _powerlines_plugin_webpack = require_chunk.__toESM(_powerlines_plugin_webpack, 1);
7
7
 
8
8
  //#region src/webpack.ts
9
9
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powerlines",
3
- "version": "0.42.38",
3
+ "version": "0.42.39",
4
4
  "private": false,
5
5
  "description": "The \"framework framework\" that simplifies modern dev tool usage, generates virtual (or actual) code modules, and improves DX across the board.",
6
6
  "keywords": [
@@ -342,9 +342,9 @@
342
342
  "@cacheable/memory": "^2.0.8",
343
343
  "@donedeal0/superdiff": "^3.2.0",
344
344
  "@jridgewell/sourcemap-codec": "^1.5.5",
345
- "@powerlines/core": "^0.13.10",
346
- "@storm-software/config": "^1.137.29",
347
- "@storm-software/config-tools": "^1.189.75",
345
+ "@powerlines/core": "^0.13.11",
346
+ "@storm-software/config": "^1.137.30",
347
+ "@storm-software/config-tools": "^1.189.76",
348
348
  "@stryke/capnp": "^0.12.92",
349
349
  "@stryke/convert": "^0.6.58",
350
350
  "@stryke/env": "^0.20.83",
@@ -368,18 +368,18 @@
368
368
  "oxc-parser": "^0.99.0",
369
369
  "oxc-resolver": "^11.19.1",
370
370
  "ts-morph": "^27.0.2",
371
- "undici": "^7.24.7",
371
+ "undici": "^7.25.0",
372
372
  "unimport": "^5.7.0",
373
373
  "unplugin": "^3.0.0"
374
374
  },
375
375
  "devDependencies": {
376
- "@storm-software/testing-tools": "^1.119.150",
376
+ "@storm-software/testing-tools": "^1.119.151",
377
377
  "@stryke/types": "^0.11.3",
378
378
  "@types/bun": "^1.3.12",
379
379
  "@types/node": "^25.6.0",
380
380
  "@types/semver": "^7.7.1",
381
381
  "bun-types-no-globals": "^1.3.11",
382
- "undici-types": "^7.24.7"
382
+ "undici-types": "^7.25.0"
383
383
  },
384
384
  "peerDependencies": {
385
385
  "@farmfe/cli": ">=1.0.5",
@@ -429,5 +429,5 @@
429
429
  "webpack": { "optional": true }
430
430
  },
431
431
  "publishConfig": { "access": "public" },
432
- "gitHead": "9cec72510580fd8ee2cafc64ccae8ca65e7746a4"
432
+ "gitHead": "dbee10b00be4d975152b4e5b82422c2a94455f70"
433
433
  }