powerlines 0.42.29 → 0.42.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-DX4IemwF.mjs → api-BQswQ9mT.mjs} +31 -71
- package/dist/api-BQswQ9mT.mjs.map +1 -0
- package/dist/{api-DjxroNtE.cjs → api-D7HzHvkw.cjs} +30 -71
- package/dist/{api-context-p1enWkF-.mjs → api-context-AY_byIdN.mjs} +4 -4
- package/dist/{api-context-p1enWkF-.mjs.map → api-context-AY_byIdN.mjs.map} +1 -1
- package/dist/{api-context-BSrRdlnu.cjs → api-context-BTrJUKNX.cjs} +4 -5
- package/dist/astro.cjs +1 -2
- package/dist/config.cjs +0 -2
- package/dist/constants.cjs +0 -2
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/esbuild.cjs +1 -2
- package/dist/farm.cjs +1 -2
- package/dist/index.cjs +3 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/next.cjs +1 -2
- package/dist/nuxt.cjs +2 -3
- package/dist/nuxt.d.mts +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/plugin-utils.cjs +0 -2
- package/dist/rolldown.cjs +1 -2
- package/dist/rollup.cjs +1 -2
- package/dist/rspack.cjs +1 -2
- package/dist/storage/index.cjs +1 -1
- package/dist/storage/index.d.cts +1 -4
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +2 -5
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +1 -1
- package/dist/{tsconfig-ChmbpAO7.cjs → tsconfig-B0kfe_iM.cjs} +1 -2
- package/dist/{tsconfig-DoV1dUYg.mjs → tsconfig-B8RooiIp.mjs} +1 -1
- package/dist/{tsconfig-DoV1dUYg.mjs.map → tsconfig-B8RooiIp.mjs.map} +1 -1
- package/dist/tsdown.cjs +1 -2
- package/dist/tsup.cjs +1 -2
- package/dist/{types-9O-s0Fpu.d.mts → types-hdziyQIH.d.mts} +1 -1
- package/dist/types-hdziyQIH.d.mts.map +1 -0
- package/dist/typescript/index.cjs +104 -4
- package/dist/typescript/index.d.mts +1 -1
- package/dist/typescript/index.mjs +102 -3
- package/dist/typescript/index.mjs.map +1 -0
- package/dist/unloader.cjs +1 -2
- package/dist/unplugin.cjs +1 -3
- package/dist/unplugin.mjs +1 -1
- package/dist/utils.cjs +0 -2
- package/dist/{virtual-BNy8T32w.cjs → virtual-CJChzKrr.cjs} +1 -2
- package/dist/{virtual-PaZGNIrj.mjs → virtual-DB9ki0Y6.mjs} +1 -1
- package/dist/{virtual-PaZGNIrj.mjs.map → virtual-DB9ki0Y6.mjs.map} +1 -1
- package/dist/vite.cjs +1 -2
- package/dist/webpack.cjs +1 -2
- package/package.json +39 -38
- package/dist/api-DX4IemwF.mjs.map +0 -1
- package/dist/api-DjxroNtE.cjs.map +0 -1
- package/dist/api-context-BSrRdlnu.cjs.map +0 -1
- package/dist/astro.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/constants.cjs.map +0 -1
- package/dist/esbuild.cjs.map +0 -1
- package/dist/farm.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/next.cjs.map +0 -1
- package/dist/nuxt.cjs.map +0 -1
- package/dist/plugin-utils.cjs.map +0 -1
- package/dist/rolldown.cjs.map +0 -1
- package/dist/rollup.cjs.map +0 -1
- package/dist/rspack.cjs.map +0 -1
- package/dist/ts-morph-B85ZbV1Q.mjs +0 -102
- package/dist/ts-morph-B85ZbV1Q.mjs.map +0 -1
- package/dist/ts-morph-Cf4wz3E0.cjs +0 -115
- package/dist/ts-morph-Cf4wz3E0.cjs.map +0 -1
- package/dist/tsconfig-ChmbpAO7.cjs.map +0 -1
- package/dist/tsdown.cjs.map +0 -1
- package/dist/tsup.cjs.map +0 -1
- package/dist/types-9O-s0Fpu.d.mts.map +0 -1
- package/dist/unloader.cjs.map +0 -1
- package/dist/unplugin.cjs.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/virtual-BNy8T32w.cjs.map +0 -1
- package/dist/vite.cjs.map +0 -1
- package/dist/webpack.cjs.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { n as createProgram } from "./ts-morph-B85ZbV1Q.mjs";
|
|
2
1
|
import { t as utils_exports } from "./utils.mjs";
|
|
3
2
|
import { t as plugin_utils_exports } from "./plugin-utils.mjs";
|
|
4
|
-
import { d as writeMetaFile, f as callHook, p as mergeConfigs, t as PowerlinesAPIContext } from "./api-context-
|
|
5
|
-
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-
|
|
3
|
+
import { d as writeMetaFile, f as callHook, p as mergeConfigs, t as PowerlinesAPIContext } from "./api-context-AY_byIdN.mjs";
|
|
4
|
+
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-B8RooiIp.mjs";
|
|
6
5
|
import { formatLogMessage } from "@storm-software/config-tools/logger/console";
|
|
7
6
|
import { toArray } from "@stryke/convert/to-array";
|
|
8
7
|
import { copyFiles } from "@stryke/fs/copy-file";
|
|
@@ -18,7 +17,8 @@ import { appendPath } from "@stryke/path/append";
|
|
|
18
17
|
import { findFileName, findFilePath, relativePath } from "@stryke/path/file-path-fns";
|
|
19
18
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
20
19
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
21
|
-
import {
|
|
20
|
+
import { replacePath } from "@stryke/path/replace";
|
|
21
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
22
22
|
import { isError } from "@stryke/type-checks/is-error";
|
|
23
23
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
24
24
|
import { isNumber } from "@stryke/type-checks/is-number";
|
|
@@ -31,22 +31,21 @@ import { isString } from "@stryke/type-checks/is-string";
|
|
|
31
31
|
import chalk from "chalk";
|
|
32
32
|
import defu$1 from "defu";
|
|
33
33
|
import Handlebars from "handlebars";
|
|
34
|
+
import { isParentPath as isParentPath$1 } from "@stryke/path";
|
|
34
35
|
import { prettyBytes } from "@stryke/string-format/pretty-bytes";
|
|
35
36
|
import { match } from "bundle-require";
|
|
36
|
-
import {
|
|
37
|
+
import { createBundle } from "dts-buddy";
|
|
37
38
|
import { getPackageName, getPackageVersion, hasPackageVersion } from "@stryke/string-format/package";
|
|
38
39
|
import { readJsonFile } from "@stryke/fs/json";
|
|
39
40
|
import { getObjectDiff } from "@donedeal0/superdiff";
|
|
40
41
|
import { StormJSON } from "@stryke/json/storm-json";
|
|
41
|
-
import { titleCase } from "@stryke/string-format/title-case";
|
|
42
42
|
|
|
43
43
|
//#region package.json
|
|
44
44
|
var name = "powerlines";
|
|
45
|
-
var version = "0.42.
|
|
45
|
+
var version = "0.42.30";
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
48
|
//#region src/_internal/helpers/generate-types.ts
|
|
49
|
-
const getModuleCommentBlockRegex = (moduleId) => new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${moduleId}(?s:.)*?\\*\\/\\s+`);
|
|
50
49
|
/**
|
|
51
50
|
* Formats the generated TypeScript types source code.
|
|
52
51
|
*
|
|
@@ -57,37 +56,6 @@ function formatTypes(code = "") {
|
|
|
57
56
|
return code.replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
60
|
-
* Formats a generated TypeScript module in the types source code.
|
|
61
|
-
*
|
|
62
|
-
* @param context - The Powerlines context.
|
|
63
|
-
* @param id - The module ID for the generated TypeScript module.
|
|
64
|
-
* @param code - The generated TypeScript module code.
|
|
65
|
-
* @returns The formatted TypeScript module code.
|
|
66
|
-
*/
|
|
67
|
-
async function formatTypesModule(context, id, code) {
|
|
68
|
-
const moduleComment = code.match(getModuleCommentBlockRegex(`${context.config.framework}:${id}`))?.find((comment) => isSetString(comment?.trim()));
|
|
69
|
-
const ast = await context.parse(code, {
|
|
70
|
-
lang: "dts",
|
|
71
|
-
astType: "ts"
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
code: `${moduleComment ? `
|
|
75
|
-
${moduleComment.trim()}` : ""}
|
|
76
|
-
declare module "${context.config.framework}:${id}" {
|
|
77
|
-
${ast.module.staticImports.filter((staticImport) => !match(staticImport.moduleRequest.value, context.config.resolve.external) && !staticImport.moduleRequest.value.startsWith("node:")).map((staticImport) => {
|
|
78
|
-
return `import type { ${staticImport.entries.map((entry) => `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : ""}`).join(", ")} } from "${staticImport.moduleRequest.value}"; `;
|
|
79
|
-
}).join("\n")}
|
|
80
|
-
|
|
81
|
-
${ast.module.staticImports.filter((staticImport) => !match(staticImport.moduleRequest.value, context.config.resolve.external) && !staticImport.moduleRequest.value.startsWith("node:")).reduce((ret, staticImport) => {
|
|
82
|
-
return `import type { ${staticImport.entries.map((entry) => `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : ""}`).join(", ")} } from "${staticImport.moduleRequest.value}";${ret.replaceAll(new RegExp(`^import.*from\\s+['"]${staticImport.moduleRequest.value}['"]\\s*;?$`, "gm"), "")}`;
|
|
83
|
-
}, code).replace(moduleComment ?? "", "").replaceAll(/^\s*export\s*declare\s*/gm, "export ").replaceAll(/^\s*declare\s*/gm, "").replaceAll(/^\s*export\s*\{\s*\}/gm, "").replaceAll(/^\s*export\s*=\s*/gm, "export default ").replaceAll(/^\s*export\s*\{/gm, "export {").replaceAll(/^\s*export\s*default\s*\{/gm, "export default {").replaceAll(/^\s*export\s*function\s*/gm, "export function ").replaceAll(/^\s*export\s*class\s*/gm, "export class ").replaceAll(/^\s*export\s*interface\s*/gm, "export interface ").replaceAll(/^\s*export\s*type\s*/gm, "export type ").replaceAll(/^\s*export\s*enum\s*/gm, "export enum ").replaceAll(/^\s*export\s*namespace\s*/gm, "export namespace ")}${ast.module.staticExports.length === 0 ? `
|
|
84
|
-
export {};` : ""}
|
|
85
|
-
}
|
|
86
|
-
`,
|
|
87
|
-
directives: ast.module.staticImports.filter((staticImport) => match(staticImport.moduleRequest.value, context.config.resolve.external) || staticImport.moduleRequest.value.startsWith("node:")).map((staticImport) => staticImport.moduleRequest.value)
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
59
|
* Emits TypeScript declaration types for the provided files using the given TypeScript configuration.
|
|
92
60
|
*
|
|
93
61
|
* @param context - The context containing options and environment paths.
|
|
@@ -103,8 +71,15 @@ async function emitBuiltinTypes(context, files) {
|
|
|
103
71
|
};
|
|
104
72
|
}
|
|
105
73
|
context.debug(`Running the TypeScript compiler for ${files.length} generated built-in module files.`);
|
|
106
|
-
|
|
107
|
-
|
|
74
|
+
let result = await createBundle({
|
|
75
|
+
context,
|
|
76
|
+
project: context.tsconfig.tsconfigFilePath,
|
|
77
|
+
output: context.typesPath,
|
|
78
|
+
include: files.map((file) => appendPath(file, context.workspaceConfig.workspaceRoot)),
|
|
79
|
+
modules: (await context.getBuiltins()).reduce((ret, file) => {
|
|
80
|
+
ret[`${context.config.framework}:${file.id}`] = file.path;
|
|
81
|
+
return ret;
|
|
82
|
+
}, {}),
|
|
108
83
|
compilerOptions: {
|
|
109
84
|
declaration: true,
|
|
110
85
|
declarationMap: false,
|
|
@@ -116,40 +91,24 @@ async function emitBuiltinTypes(context, files) {
|
|
|
116
91
|
tsBuildInfoFile: void 0
|
|
117
92
|
}
|
|
118
93
|
});
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
code: "",
|
|
131
|
-
directives: []
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
let result = "";
|
|
135
|
-
const directives = [];
|
|
136
|
-
for (const emittedFile of emittedFiles) {
|
|
137
|
-
context.trace(`Processing emitted type declaration file: ${emittedFile.filePath}`);
|
|
138
|
-
const filePath = appendPath(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
|
|
139
|
-
if (!filePath.endsWith(".map") && findFileName(filePath) !== "tsconfig.tsbuildinfo" && isParentPath(filePath, context.builtinsPath)) {
|
|
140
|
-
const moduleId = replaceExtension(replacePath(replacePath(filePath, context.builtinsPath), replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)), "", { fullExtension: true });
|
|
141
|
-
if (context.builtins.includes(moduleId)) {
|
|
142
|
-
const formatted = await formatTypesModule(context, moduleId, emittedFile.text);
|
|
143
|
-
result += formatted.code;
|
|
144
|
-
directives.push(...formatted.directives);
|
|
94
|
+
result = formatTypes(result);
|
|
95
|
+
for (const file of files.map((file) => appendPath(file, context.workspaceConfig.workspaceRoot)).filter((file) => isParentPath$1(file, context.builtinsPath))) {
|
|
96
|
+
const content = await context.fs.read(file);
|
|
97
|
+
if (isSetString(content)) {
|
|
98
|
+
const moduleComment = content.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${context.config.framework}:(?:${context.builtins.join("|")})(?s:.)*?\\*\\/\\s+`))?.find((comment) => isSetString(comment?.trim()));
|
|
99
|
+
if (moduleComment) {
|
|
100
|
+
context.debug(`Adding module-level comment for the built-in module types declaration for file: ${file}`);
|
|
101
|
+
const metadata = context.fs.getMetadata(file);
|
|
102
|
+
if (metadata?.id) result = result.replace(`declare module "${context.config.framework}:${metadata.id}" {`, `${moduleComment.trim()}
|
|
103
|
+
declare module "${context.config.framework}:${metadata.id}" {`);
|
|
145
104
|
}
|
|
146
105
|
}
|
|
147
106
|
}
|
|
148
|
-
result = await (0, utils_exports.format)(context, context.typesPath,
|
|
107
|
+
result = await (0, utils_exports.format)(context, context.typesPath, result);
|
|
149
108
|
context.debug(`A TypeScript declaration file (size: ${prettyBytes(new Blob(toArray(result)).size)}) emitted for the built-in modules types.`);
|
|
150
109
|
return {
|
|
151
110
|
code: result,
|
|
152
|
-
directives
|
|
111
|
+
directives: []
|
|
153
112
|
};
|
|
154
113
|
}
|
|
155
114
|
|
|
@@ -326,8 +285,9 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
326
285
|
addPlugin: api.#addPlugin.bind(api)
|
|
327
286
|
};
|
|
328
287
|
api.context.info(`🔌 The Powerlines Engine v${version} has started`);
|
|
329
|
-
for (const plugin of api.context.config.plugins ?? []) await api.#addPlugin(plugin);
|
|
288
|
+
for (const plugin of api.context.config.plugins.flat(10) ?? []) await api.#addPlugin(plugin);
|
|
330
289
|
if (api.context.plugins.length === 0) api.context.warn("No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
|
|
290
|
+
else api.context.info(`🔌 Loaded ${api.context.plugins.length} ${titleCase(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n\n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, utils_exports.colorText)(plugin.name)}`).join("\n")}`);
|
|
331
291
|
const pluginConfig = await api.callHook("config", {
|
|
332
292
|
environment: await api.context.getEnvironment(),
|
|
333
293
|
sequential: true,
|
|
@@ -898,4 +858,4 @@ ${formatTypes(code)}
|
|
|
898
858
|
|
|
899
859
|
//#endregion
|
|
900
860
|
export { name as n, version as r, PowerlinesAPI as t };
|
|
901
|
-
//# sourceMappingURL=api-
|
|
861
|
+
//# sourceMappingURL=api-BQswQ9mT.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-BQswQ9mT.mjs","names":["isParentPath","#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 { isParentPath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { prettyBytes } from \"@stryke/string-format/pretty-bytes\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { match } from \"bundle-require\";\nimport { createBundle } from \"dts-buddy\";\nimport { Context } from \"../../types\";\nimport { format } from \"../../utils\";\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\n/**\n * Formats a generated TypeScript module in the types source code.\n *\n * @param context - The Powerlines context.\n * @param id - The module ID for the generated TypeScript module.\n * @param code - The generated TypeScript module code.\n * @returns The formatted TypeScript module code.\n */\nexport async function formatTypesModule(\n context: Context,\n id: string,\n code: string\n): Promise<{ code: string; directives: string[] }> {\n const ast = await context.parse(code, {\n lang: \"dts\",\n astType: \"ts\"\n });\n\n return {\n code: `declare module \"${context.config.framework}:${id}\" {\n ${ast.module.staticImports\n .filter(\n staticImport =>\n !match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) && !staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .map(staticImport => {\n return `import type { ${staticImport.entries\n .map(\n entry =>\n `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : \"\"}`\n )\n .join(\", \")} } from \"${staticImport.moduleRequest.value}\"; `;\n })\n .join(\"\\n\")}\n\n ${ast.module.staticImports\n .filter(\n staticImport =>\n !match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) && !staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .reduce((ret, staticImport) => {\n return `import type { ${staticImport.entries\n .map(\n entry =>\n `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : \"\"}`\n )\n .join(\n \", \"\n )} } from \"${staticImport.moduleRequest.value}\";${ret.replaceAll(\n new RegExp(\n `^import.*from\\\\s+['\"]${staticImport.moduleRequest.value}['\"]\\\\s*;?$`,\n \"gm\"\n ),\n \"\"\n )}`;\n }, code)\n .replaceAll(/^\\s*export\\s*declare\\s*/gm, \"export \")\n .replaceAll(/^\\s*declare\\s*/gm, \"\")\n .replaceAll(/^\\s*export\\s*\\{\\s*\\}/gm, \"\")\n .replaceAll(/^\\s*export\\s*=\\s*/gm, \"export default \")\n .replaceAll(/^\\s*export\\s*\\{/gm, \"export {\")\n .replaceAll(/^\\s*export\\s*default\\s*\\{/gm, \"export default {\")\n .replaceAll(/^\\s*export\\s*function\\s*/gm, \"export function \")\n .replaceAll(/^\\s*export\\s*class\\s*/gm, \"export class \")\n .replaceAll(/^\\s*export\\s*interface\\s*/gm, \"export interface \")\n .replaceAll(/^\\s*export\\s*type\\s*/gm, \"export type \")\n .replaceAll(/^\\s*export\\s*enum\\s*/gm, \"export enum \")\n .replaceAll(/^\\s*export\\s*namespace\\s*/gm, \"export namespace \")}${\n ast.module.staticExports.length === 0\n ? `\n export {};`\n : \"\"\n }\n}\n`,\n directives: ast.module.staticImports\n .filter(\n staticImport =>\n match(\n staticImport.moduleRequest.value,\n context.config.resolve.external\n ) || staticImport.moduleRequest.value.startsWith(\"node:\")\n )\n .map(staticImport => staticImport.moduleRequest.value)\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 let result = await createBundle({\n context,\n project: context.tsconfig.tsconfigFilePath,\n output: context.typesPath,\n include: files.map(file =>\n appendPath(file, context.workspaceConfig.workspaceRoot)\n ),\n modules: (await context.getBuiltins()).reduce(\n (ret, file) => {\n ret[`${context.config.framework}:${file.id}`] = file.path;\n return ret;\n },\n {} as Record<string, string>\n ),\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 result = formatTypes(result);\n for (const file of files\n .map(file => appendPath(file, context.workspaceConfig.workspaceRoot))\n .filter(file => isParentPath(file, context.builtinsPath))) {\n const content = await context.fs.read(file);\n if (isSetString(content)) {\n const moduleComment = content\n .match(\n new RegExp(\n `\\\\/\\\\*\\\\*(?s:.)*?@module\\\\s+${\n context.config.framework\n }:(?:${context.builtins.join(\"|\")})(?s:.)*?\\\\*\\\\/\\\\s+`\n )\n )\n ?.find(comment => isSetString(comment?.trim()));\n\n if (moduleComment) {\n context.debug(\n `Adding module-level comment for the built-in module types declaration for file: ${file}`\n );\n\n const metadata = context.fs.getMetadata(file);\n if (metadata?.id) {\n result = result.replace(\n `declare module \"${context.config.framework}:${metadata.id}\" {`,\n `${moduleComment.trim()}\ndeclare module \"${context.config.framework}:${metadata.id}\" {`\n );\n }\n }\n }\n }\n\n result = await format(context, context.typesPath, result);\n\n context.debug(\n `A TypeScript declaration file (size: ${prettyBytes(\n new Blob(toArray(result)).size\n )}) emitted for the built-in modules types.`\n );\n\n return { code: result, 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 checkDedupe,\n findInvalidPluginConfig,\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 api.#context.$$internal = {\n api,\n addPlugin: api.#addPlugin.bind(api)\n };\n\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\\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 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 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 }\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 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 }\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 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 }\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 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 }\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 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 }\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 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 }\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 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 }\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 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 }\n\n /**\n * Finalization process\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 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 }\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 (checkDedupe<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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACmCA,SAAgB,YAAY,OAAO,IAAY;AAC7C,QAAO,KAAK,WAAW,aAAa,GAAG,CAAC,QAAQ,QAAQ,GAAG;;;;;;;;;AAuG7D,eAAsB,iBACpB,SACA,OACiD;AACjD,KAAI,MAAM,WAAW,GAAG;AACtB,UAAQ,MACN,kHACD;AACD,SAAO;GAAE,MAAM;GAAI,YAAY,EAAE;GAAE;;AAGrC,SAAQ,MACN,uCACE,MAAM,OACP,mCACF;CAED,IAAI,SAAS,MAAM,aAAa;EAC9B;EACA,SAAS,QAAQ,SAAS;EAC1B,QAAQ,QAAQ;EAChB,SAAS,MAAM,KAAI,SACjB,WAAW,MAAM,QAAQ,gBAAgB,cAAc,CACxD;EACD,UAAU,MAAM,QAAQ,aAAa,EAAE,QACpC,KAAK,SAAS;AACb,OAAI,GAAG,QAAQ,OAAO,UAAU,GAAG,KAAK,QAAQ,KAAK;AACrD,UAAO;KAET,EAAE,CACH;EACD,iBAAiB;GACf,aAAa;GACb,gBAAgB;GAChB,qBAAqB;GACrB,WAAW;GACX,QAAQ,YACN,QAAQ,cACR,QAAQ,gBAAgB,cACzB;GACD,WAAW;GACX,aAAa;GACb,iBAAiB;GAClB;EACF,CAAC;AAEF,UAAS,YAAY,OAAO;AAC5B,MAAK,MAAM,QAAQ,MAChB,KAAI,SAAQ,WAAW,MAAM,QAAQ,gBAAgB,cAAc,CAAC,CACpE,QAAO,SAAQA,eAAa,MAAM,QAAQ,aAAa,CAAC,EAAE;EAC3D,MAAM,UAAU,MAAM,QAAQ,GAAG,KAAK,KAAK;AAC3C,MAAI,Y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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,9 +1,8 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-AIJqnxB6.cjs');
|
|
2
|
-
const require_ts_morph = require('./ts-morph-Cf4wz3E0.cjs');
|
|
3
2
|
const require_utils = require('./utils.cjs');
|
|
4
3
|
const require_plugin_utils = require('./plugin-utils.cjs');
|
|
5
|
-
const require_api_context = require('./api-context-
|
|
6
|
-
const require_tsconfig = require('./tsconfig-
|
|
4
|
+
const require_api_context = require('./api-context-BTrJUKNX.cjs');
|
|
5
|
+
const require_tsconfig = require('./tsconfig-B0kfe_iM.cjs');
|
|
7
6
|
let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
|
|
8
7
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
9
8
|
let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
|
|
@@ -20,6 +19,7 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
|
20
19
|
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
21
20
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
22
21
|
let _stryke_path_replace = require("@stryke/path/replace");
|
|
22
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
23
23
|
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
24
24
|
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
25
25
|
let _stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
|
|
@@ -35,22 +35,21 @@ let defu = require("defu");
|
|
|
35
35
|
defu = require_chunk.__toESM(defu);
|
|
36
36
|
let handlebars = require("handlebars");
|
|
37
37
|
handlebars = require_chunk.__toESM(handlebars);
|
|
38
|
+
let _stryke_path = require("@stryke/path");
|
|
38
39
|
let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
|
|
39
40
|
let bundle_require = require("bundle-require");
|
|
40
|
-
let
|
|
41
|
+
let dts_buddy = require("dts-buddy");
|
|
41
42
|
let _stryke_string_format_package = require("@stryke/string-format/package");
|
|
42
43
|
let _stryke_fs_json = require("@stryke/fs/json");
|
|
43
44
|
let _donedeal0_superdiff = require("@donedeal0/superdiff");
|
|
44
45
|
let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
45
|
-
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
46
46
|
|
|
47
47
|
//#region package.json
|
|
48
48
|
var name = "powerlines";
|
|
49
|
-
var version = "0.42.
|
|
49
|
+
var version = "0.42.30";
|
|
50
50
|
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/_internal/helpers/generate-types.ts
|
|
53
|
-
const getModuleCommentBlockRegex = (moduleId) => new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${moduleId}(?s:.)*?\\*\\/\\s+`);
|
|
54
53
|
/**
|
|
55
54
|
* Formats the generated TypeScript types source code.
|
|
56
55
|
*
|
|
@@ -61,37 +60,6 @@ function formatTypes(code = "") {
|
|
|
61
60
|
return code.replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
62
61
|
}
|
|
63
62
|
/**
|
|
64
|
-
* Formats a generated TypeScript module in the types source code.
|
|
65
|
-
*
|
|
66
|
-
* @param context - The Powerlines context.
|
|
67
|
-
* @param id - The module ID for the generated TypeScript module.
|
|
68
|
-
* @param code - The generated TypeScript module code.
|
|
69
|
-
* @returns The formatted TypeScript module code.
|
|
70
|
-
*/
|
|
71
|
-
async function formatTypesModule(context, id, code) {
|
|
72
|
-
const moduleComment = code.match(getModuleCommentBlockRegex(`${context.config.framework}:${id}`))?.find((comment) => (0, _stryke_type_checks_is_set_string.isSetString)(comment?.trim()));
|
|
73
|
-
const ast = await context.parse(code, {
|
|
74
|
-
lang: "dts",
|
|
75
|
-
astType: "ts"
|
|
76
|
-
});
|
|
77
|
-
return {
|
|
78
|
-
code: `${moduleComment ? `
|
|
79
|
-
${moduleComment.trim()}` : ""}
|
|
80
|
-
declare module "${context.config.framework}:${id}" {
|
|
81
|
-
${ast.module.staticImports.filter((staticImport) => !(0, bundle_require.match)(staticImport.moduleRequest.value, context.config.resolve.external) && !staticImport.moduleRequest.value.startsWith("node:")).map((staticImport) => {
|
|
82
|
-
return `import type { ${staticImport.entries.map((entry) => `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : ""}`).join(", ")} } from "${staticImport.moduleRequest.value}"; `;
|
|
83
|
-
}).join("\n")}
|
|
84
|
-
|
|
85
|
-
${ast.module.staticImports.filter((staticImport) => !(0, bundle_require.match)(staticImport.moduleRequest.value, context.config.resolve.external) && !staticImport.moduleRequest.value.startsWith("node:")).reduce((ret, staticImport) => {
|
|
86
|
-
return `import type { ${staticImport.entries.map((entry) => `${entry.importName.name}${entry.localName.value ? ` as ${entry.localName.value}` : ""}`).join(", ")} } from "${staticImport.moduleRequest.value}";${ret.replaceAll(new RegExp(`^import.*from\\s+['"]${staticImport.moduleRequest.value}['"]\\s*;?$`, "gm"), "")}`;
|
|
87
|
-
}, code).replace(moduleComment ?? "", "").replaceAll(/^\s*export\s*declare\s*/gm, "export ").replaceAll(/^\s*declare\s*/gm, "").replaceAll(/^\s*export\s*\{\s*\}/gm, "").replaceAll(/^\s*export\s*=\s*/gm, "export default ").replaceAll(/^\s*export\s*\{/gm, "export {").replaceAll(/^\s*export\s*default\s*\{/gm, "export default {").replaceAll(/^\s*export\s*function\s*/gm, "export function ").replaceAll(/^\s*export\s*class\s*/gm, "export class ").replaceAll(/^\s*export\s*interface\s*/gm, "export interface ").replaceAll(/^\s*export\s*type\s*/gm, "export type ").replaceAll(/^\s*export\s*enum\s*/gm, "export enum ").replaceAll(/^\s*export\s*namespace\s*/gm, "export namespace ")}${ast.module.staticExports.length === 0 ? `
|
|
88
|
-
export {};` : ""}
|
|
89
|
-
}
|
|
90
|
-
`,
|
|
91
|
-
directives: ast.module.staticImports.filter((staticImport) => (0, bundle_require.match)(staticImport.moduleRequest.value, context.config.resolve.external) || staticImport.moduleRequest.value.startsWith("node:")).map((staticImport) => staticImport.moduleRequest.value)
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
63
|
* Emits TypeScript declaration types for the provided files using the given TypeScript configuration.
|
|
96
64
|
*
|
|
97
65
|
* @param context - The context containing options and environment paths.
|
|
@@ -107,8 +75,15 @@ async function emitBuiltinTypes(context, files) {
|
|
|
107
75
|
};
|
|
108
76
|
}
|
|
109
77
|
context.debug(`Running the TypeScript compiler for ${files.length} generated built-in module files.`);
|
|
110
|
-
|
|
111
|
-
|
|
78
|
+
let result = await (0, dts_buddy.createBundle)({
|
|
79
|
+
context,
|
|
80
|
+
project: context.tsconfig.tsconfigFilePath,
|
|
81
|
+
output: context.typesPath,
|
|
82
|
+
include: files.map((file) => (0, _stryke_path_append.appendPath)(file, context.workspaceConfig.workspaceRoot)),
|
|
83
|
+
modules: (await context.getBuiltins()).reduce((ret, file) => {
|
|
84
|
+
ret[`${context.config.framework}:${file.id}`] = file.path;
|
|
85
|
+
return ret;
|
|
86
|
+
}, {}),
|
|
112
87
|
compilerOptions: {
|
|
113
88
|
declaration: true,
|
|
114
89
|
declarationMap: false,
|
|
@@ -120,40 +95,24 @@ async function emitBuiltinTypes(context, files) {
|
|
|
120
95
|
tsBuildInfoFile: void 0
|
|
121
96
|
}
|
|
122
97
|
});
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
code: "",
|
|
135
|
-
directives: []
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
let result = "";
|
|
139
|
-
const directives = [];
|
|
140
|
-
for (const emittedFile of emittedFiles) {
|
|
141
|
-
context.trace(`Processing emitted type declaration file: ${emittedFile.filePath}`);
|
|
142
|
-
const filePath = (0, _stryke_path_append.appendPath)(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
|
|
143
|
-
if (!filePath.endsWith(".map") && (0, _stryke_path_file_path_fns.findFileName)(filePath) !== "tsconfig.tsbuildinfo" && (0, _stryke_path_is_parent_path.isParentPath)(filePath, context.builtinsPath)) {
|
|
144
|
-
const moduleId = (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(filePath, context.builtinsPath), (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)), "", { fullExtension: true });
|
|
145
|
-
if (context.builtins.includes(moduleId)) {
|
|
146
|
-
const formatted = await formatTypesModule(context, moduleId, emittedFile.text);
|
|
147
|
-
result += formatted.code;
|
|
148
|
-
directives.push(...formatted.directives);
|
|
98
|
+
result = formatTypes(result);
|
|
99
|
+
for (const file of files.map((file) => (0, _stryke_path_append.appendPath)(file, context.workspaceConfig.workspaceRoot)).filter((file) => (0, _stryke_path.isParentPath)(file, context.builtinsPath))) {
|
|
100
|
+
const content = await context.fs.read(file);
|
|
101
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(content)) {
|
|
102
|
+
const moduleComment = content.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${context.config.framework}:(?:${context.builtins.join("|")})(?s:.)*?\\*\\/\\s+`))?.find((comment) => (0, _stryke_type_checks_is_set_string.isSetString)(comment?.trim()));
|
|
103
|
+
if (moduleComment) {
|
|
104
|
+
context.debug(`Adding module-level comment for the built-in module types declaration for file: ${file}`);
|
|
105
|
+
const metadata = context.fs.getMetadata(file);
|
|
106
|
+
if (metadata?.id) result = result.replace(`declare module "${context.config.framework}:${metadata.id}" {`, `${moduleComment.trim()}
|
|
107
|
+
declare module "${context.config.framework}:${metadata.id}" {`);
|
|
149
108
|
}
|
|
150
109
|
}
|
|
151
110
|
}
|
|
152
|
-
result = await (0, require_utils.utils_exports.format)(context, context.typesPath,
|
|
111
|
+
result = await (0, require_utils.utils_exports.format)(context, context.typesPath, result);
|
|
153
112
|
context.debug(`A TypeScript declaration file (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new Blob((0, _stryke_convert_to_array.toArray)(result)).size)}) emitted for the built-in modules types.`);
|
|
154
113
|
return {
|
|
155
114
|
code: result,
|
|
156
|
-
directives
|
|
115
|
+
directives: []
|
|
157
116
|
};
|
|
158
117
|
}
|
|
159
118
|
|
|
@@ -330,8 +289,9 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
330
289
|
addPlugin: api.#addPlugin.bind(api)
|
|
331
290
|
};
|
|
332
291
|
api.context.info(`🔌 The Powerlines Engine v${version} has started`);
|
|
333
|
-
for (const plugin of api.context.config.plugins ?? []) await api.#addPlugin(plugin);
|
|
292
|
+
for (const plugin of api.context.config.plugins.flat(10) ?? []) await api.#addPlugin(plugin);
|
|
334
293
|
if (api.context.plugins.length === 0) api.context.warn("No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
|
|
294
|
+
else api.context.info(`🔌 Loaded ${api.context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n\n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, require_utils.utils_exports.colorText)(plugin.name)}`).join("\n")}`);
|
|
335
295
|
const pluginConfig = await api.callHook("config", {
|
|
336
296
|
environment: await api.context.getEnvironment(),
|
|
337
297
|
sequential: true,
|
|
@@ -918,5 +878,4 @@ Object.defineProperty(exports, 'version', {
|
|
|
918
878
|
get: function () {
|
|
919
879
|
return version;
|
|
920
880
|
}
|
|
921
|
-
});
|
|
922
|
-
//# sourceMappingURL=api-DjxroNtE.cjs.map
|
|
881
|
+
});
|