powerlines 0.42.33 → 0.42.35
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-KqyZ6kMY.mjs → api-DBPe7xMz.mjs} +173 -40
- package/dist/api-DBPe7xMz.mjs.map +1 -0
- package/dist/{api-CIDAmydP.cjs → api-P7DHgTlT.cjs} +171 -38
- package/dist/{api-context-Ck0P2lLD.cjs → api-context-BurprRit.cjs} +85 -19
- package/dist/{api-context-DiZCovj6.mjs → api-context-CEJ3s11k.mjs} +86 -20
- package/dist/api-context-CEJ3s11k.mjs.map +1 -0
- package/dist/context/index.cjs +1 -1
- package/dist/context/index.d.cts +24 -0
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +24 -0
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- 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/nuxt.cjs +1 -1
- package/dist/nuxt.mjs +1 -1
- package/dist/unplugin.cjs +1 -1
- package/dist/unplugin.mjs +1 -1
- package/package.json +15 -12
- package/dist/api-KqyZ6kMY.mjs.map +0 -1
- package/dist/api-context-DiZCovj6.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as createProgram } from "./ts-morph-B85ZbV1Q.mjs";
|
|
2
2
|
import { t as utils_exports } from "./utils.mjs";
|
|
3
3
|
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-
|
|
4
|
+
import { d as writeMetaFile, f as callHook, p as mergeConfigs, t as PowerlinesAPIContext } from "./api-context-CEJ3s11k.mjs";
|
|
5
5
|
import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-DoV1dUYg.mjs";
|
|
6
6
|
import { formatLogMessage } from "@storm-software/config-tools/logger/console";
|
|
7
7
|
import { toArray } from "@stryke/convert/to-array";
|
|
@@ -33,8 +33,7 @@ import chalk from "chalk";
|
|
|
33
33
|
import defu$1 from "defu";
|
|
34
34
|
import Handlebars from "handlebars";
|
|
35
35
|
import { prettyBytes } from "@stryke/string-format/pretty-bytes";
|
|
36
|
-
import {
|
|
37
|
-
import { DiagnosticCategory } from "ts-morph";
|
|
36
|
+
import { DiagnosticCategory, Node, Project } from "ts-morph";
|
|
38
37
|
import { getPackageName, getPackageVersion, hasPackageVersion } from "@stryke/string-format/package";
|
|
39
38
|
import { readJsonFile } from "@stryke/fs/json";
|
|
40
39
|
import { getObjectDiff } from "@donedeal0/superdiff";
|
|
@@ -42,7 +41,7 @@ import { StormJSON } from "@stryke/json/storm-json";
|
|
|
42
41
|
|
|
43
42
|
//#region package.json
|
|
44
43
|
var name = "powerlines";
|
|
45
|
-
var version = "0.42.
|
|
44
|
+
var version = "0.42.35";
|
|
46
45
|
|
|
47
46
|
//#endregion
|
|
48
47
|
//#region src/_internal/helpers/generate-types.ts
|
|
@@ -55,31 +54,96 @@ var version = "0.42.33";
|
|
|
55
54
|
function formatTypes(code = "") {
|
|
56
55
|
return code.replaceAll("#private;", "").replace(/__Ω/g, "");
|
|
57
56
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*/
|
|
66
|
-
async function formatTypesModule(context, id, code) {
|
|
67
|
-
const moduleComment = code.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${context.config.framework}:${id}(?s:.)*?\\*\\/\\s+`))?.find((comment) => isSetString(comment?.trim()));
|
|
68
|
-
const ast = await context.parse(code, {
|
|
69
|
-
lang: "dts",
|
|
70
|
-
astType: "ts"
|
|
57
|
+
async function writeModuleDeclarations(context, filePath, id, code, fileToModuleMap) {
|
|
58
|
+
const mappings = /* @__PURE__ */ new Map();
|
|
59
|
+
const ambient = [];
|
|
60
|
+
const sourceFile = new Project({ useInMemoryFileSystem: true }).createSourceFile("module.d.ts", code);
|
|
61
|
+
for (const ref of sourceFile.getTypeReferenceDirectives()) ambient.push({
|
|
62
|
+
id: ref.getFileName(),
|
|
63
|
+
external: true
|
|
71
64
|
});
|
|
65
|
+
const importLines = [];
|
|
66
|
+
const reExportLines = [];
|
|
67
|
+
const declarationLines = [];
|
|
68
|
+
for (const statement of sourceFile.getStatements()) {
|
|
69
|
+
if (Node.isImportDeclaration(statement)) {
|
|
70
|
+
const moduleSpec = statement.getModuleSpecifierValue();
|
|
71
|
+
const defaultImport = statement.getDefaultImport();
|
|
72
|
+
const namedImports = statement.getNamedImports();
|
|
73
|
+
const namespaceImport = statement.getNamespaceImport();
|
|
74
|
+
if (!defaultImport && namedImports.length === 0 && !namespaceImport) {
|
|
75
|
+
ambient.push({
|
|
76
|
+
id: moduleSpec,
|
|
77
|
+
external: !context.fs.isResolvableId(moduleSpec, filePath)
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
let resolvedSpec = moduleSpec;
|
|
82
|
+
if (context.fs.isResolvableId(moduleSpec, filePath)) {
|
|
83
|
+
const resolved = await context.resolve(moduleSpec, filePath);
|
|
84
|
+
if (resolved) {
|
|
85
|
+
const mapped = fileToModuleMap.get(resolved.id);
|
|
86
|
+
if (mapped) resolvedSpec = mapped;
|
|
87
|
+
else context.trace(`Could not resolve relative import '${moduleSpec}' from '${filePath}' to a builtin module. Keeping as-is.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (namespaceImport) importLines.push(`\timport * as ${namespaceImport.getText()} from '${resolvedSpec}';`);
|
|
91
|
+
else {
|
|
92
|
+
const specifiers = [];
|
|
93
|
+
if (defaultImport) specifiers.push(`default as ${defaultImport.getText()}`);
|
|
94
|
+
for (const named of namedImports) {
|
|
95
|
+
const alias = named.getAliasNode()?.getText();
|
|
96
|
+
specifiers.push(alias ? `${named.getName()} as ${alias}` : named.getName());
|
|
97
|
+
}
|
|
98
|
+
if (specifiers.length > 0) {
|
|
99
|
+
const typeOnly = statement.isTypeOnly() ? " type" : "";
|
|
100
|
+
importLines.push(`\timport${typeOnly} { ${specifiers.join(", ")} } from '${resolvedSpec}';`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (Node.isExportDeclaration(statement)) {
|
|
106
|
+
const moduleSpec = statement.getModuleSpecifierValue();
|
|
107
|
+
if (moduleSpec) {
|
|
108
|
+
let resolvedSpec = moduleSpec;
|
|
109
|
+
if (context.fs.isResolvableId(moduleSpec, filePath)) {
|
|
110
|
+
const resolved = await context.resolve(moduleSpec, filePath);
|
|
111
|
+
if (resolved) {
|
|
112
|
+
const mapped = fileToModuleMap.get(resolved.id);
|
|
113
|
+
if (mapped) resolvedSpec = mapped;
|
|
114
|
+
else context.trace(`Could not resolve relative import '${moduleSpec}' from '${filePath}' to a builtin module. Keeping as-is.`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const namedExports = statement.getNamedExports();
|
|
118
|
+
if (namedExports.length > 0) {
|
|
119
|
+
const specifiers = namedExports.map((named) => {
|
|
120
|
+
const alias = named.getAliasNode()?.getText();
|
|
121
|
+
return alias ? `${named.getName()} as ${alias}` : named.getName();
|
|
122
|
+
});
|
|
123
|
+
const typeOnly = statement.isTypeOnly() ? " type" : "";
|
|
124
|
+
reExportLines.push(`\texport${typeOnly} { ${specifiers.join(", ")} } from '${resolvedSpec}';`);
|
|
125
|
+
} else reExportLines.push(`\texport * from '${resolvedSpec}';`);
|
|
126
|
+
} else declarationLines.push(`\t${statement.getText()}`);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (Node.isExportAssignment(statement)) {
|
|
130
|
+
declarationLines.push(`\t${statement.getText()}`);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const text = statement.getText();
|
|
134
|
+
if (text.includes("//# sourceMappingURL=")) continue;
|
|
135
|
+
declarationLines.push(formatTypes(text.replace(/^(export\s+)?declare\s+/, "$1")).split("\n").map((line) => `\t${line}`).join("\n"));
|
|
136
|
+
}
|
|
137
|
+
const moduleComment = code.match(new RegExp(`\\/\\*\\*(?s:.)*?@module\\s+${context.config.framework}:${id}(?s:.)*?\\*\\/\\s+`))?.find((comment) => isSetString(comment?.trim()));
|
|
138
|
+
let content = `${moduleComment ? `${moduleComment.trim()}\n` : ""}declare module "${context.config.framework}:${id}" {`;
|
|
139
|
+
for (const line of importLines) content += `\n${line}`;
|
|
140
|
+
for (const line of reExportLines) content += `\n${line}`;
|
|
141
|
+
for (const line of declarationLines) content += `\n${line}`;
|
|
142
|
+
content += "\n}";
|
|
72
143
|
return {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
${ast.module.staticImports.filter((staticImport) => !match(staticImport.moduleRequest.value, context.config.resolve.external) && !staticImport.moduleRequest.value.startsWith("node:")).reduce((ret, staticImport) => {
|
|
77
|
-
return ret.replaceAll(new RegExp(`^import.*from\\s+['"]${staticImport.moduleRequest.value}['"]\\s*;?$`, "gm"), "");
|
|
78
|
-
}, 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 ? `
|
|
79
|
-
export {};` : ""}
|
|
80
|
-
}
|
|
81
|
-
`,
|
|
82
|
-
directives: ast.module.staticImports.filter((staticImport) => match(staticImport.moduleRequest.value, context.config.resolve.external) || staticImport.moduleRequest.value.startsWith("node:")).map((staticImport) => staticImport.moduleRequest.value.startsWith("node:") ? "node" : Object.keys(context.packageJson.dependencies ?? {}).find((dependency) => staticImport.moduleRequest.value.startsWith(dependency) || staticImport.moduleRequest.value.startsWith(dependency.replace(/^@types\//, ""))) || Object.keys(context.packageJson.devDependencies ?? {}).find((dependency) => staticImport.moduleRequest.value.startsWith(dependency) || staticImport.moduleRequest.value.startsWith(dependency.replace(/^@types\//, ""))) || Object.keys(context.packageJson.peerDependencies ?? {}).find((dependency) => staticImport.moduleRequest.value.startsWith(dependency) || staticImport.moduleRequest.value.startsWith(dependency.replace(/^@types\//, ""))) || staticImport.moduleRequest.value).filter(Boolean).map((dependency) => dependency.replace(/^@types\//, ""))
|
|
144
|
+
content,
|
|
145
|
+
mappings,
|
|
146
|
+
ambient
|
|
83
147
|
};
|
|
84
148
|
}
|
|
85
149
|
/**
|
|
@@ -126,24 +190,73 @@ async function emitBuiltinTypes(context, files) {
|
|
|
126
190
|
directives: []
|
|
127
191
|
};
|
|
128
192
|
}
|
|
129
|
-
|
|
130
|
-
const
|
|
193
|
+
const fileToModuleMap = /* @__PURE__ */ new Map();
|
|
194
|
+
const emittedBuiltinFiles = [];
|
|
131
195
|
for (const emittedFile of emittedFiles) {
|
|
132
|
-
context.trace(`Processing emitted type declaration file: ${emittedFile.filePath}`);
|
|
133
196
|
const filePath = appendPath(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
|
|
134
197
|
if (!filePath.endsWith(".map") && findFileName(filePath) !== "tsconfig.tsbuildinfo" && isParentPath(filePath, context.builtinsPath)) {
|
|
135
198
|
const moduleId = replaceExtension(replacePath(replacePath(filePath, context.builtinsPath), replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)), "", { fullExtension: true });
|
|
136
199
|
if (context.builtins.includes(moduleId)) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
200
|
+
fileToModuleMap.set(filePath, moduleId);
|
|
201
|
+
emittedBuiltinFiles.push({
|
|
202
|
+
filePath,
|
|
203
|
+
text: emittedFile.text
|
|
204
|
+
});
|
|
140
205
|
}
|
|
141
206
|
}
|
|
142
207
|
}
|
|
143
|
-
|
|
144
|
-
|
|
208
|
+
const builtins = await context.getBuiltins();
|
|
209
|
+
const emittedContentMap = /* @__PURE__ */ new Map();
|
|
210
|
+
for (const emittedFile of emittedFiles) {
|
|
211
|
+
const filePath = appendPath(emittedFile.filePath, context.workspaceConfig.workspaceRoot);
|
|
212
|
+
if (!filePath.endsWith(".map") && findFileName(filePath) !== "tsconfig.tsbuildinfo") emittedContentMap.set(filePath, emittedFile.text);
|
|
213
|
+
}
|
|
214
|
+
let code = "";
|
|
215
|
+
const directives = [];
|
|
216
|
+
const ambientModules = /* @__PURE__ */ new Set();
|
|
217
|
+
let isFirst = true;
|
|
218
|
+
for (const entry of emittedBuiltinFiles) {
|
|
219
|
+
context.trace(`Processing emitted type declaration file: ${entry.filePath}`);
|
|
220
|
+
const moduleId = fileToModuleMap.get(entry.filePath);
|
|
221
|
+
const moduleDecl = await writeModuleDeclarations(context, entry.filePath, moduleId, entry.text, fileToModuleMap);
|
|
222
|
+
if (!isFirst) code += "\n\n";
|
|
223
|
+
isFirst = false;
|
|
224
|
+
code += moduleDecl.content;
|
|
225
|
+
for (const dep of moduleDecl.ambient) if (dep.external) {
|
|
226
|
+
const directive = dep.id;
|
|
227
|
+
if (!directives.includes(directive)) directives.push(directive);
|
|
228
|
+
} else if (builtins.some((builtin) => builtin.id === dep.id)) ambientModules.add(builtins.find((builtin) => builtin.id === dep.id).path);
|
|
229
|
+
else if (builtins.some((builtin) => replaceExtension(builtin.path) === replaceExtension(dep.id))) ambientModules.add(dep.id);
|
|
230
|
+
else {
|
|
231
|
+
const resolved = await context.resolve(dep.id, entry.filePath);
|
|
232
|
+
if (resolved) {
|
|
233
|
+
for (const name of [
|
|
234
|
+
resolved.id,
|
|
235
|
+
`${resolved.id}.d.ts`,
|
|
236
|
+
`${resolved.id}.d.mts`,
|
|
237
|
+
`${resolved.id}.d.cts`,
|
|
238
|
+
replaceExtension(resolved.id, ".d.ts"),
|
|
239
|
+
replaceExtension(resolved.id, ".d.mts"),
|
|
240
|
+
replaceExtension(resolved.id, ".d.cts"),
|
|
241
|
+
`${resolved.id}/index.d.ts`
|
|
242
|
+
]) if (emittedContentMap.has(name)) {
|
|
243
|
+
ambientModules.add(name);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
for (const ambientFile of ambientModules) {
|
|
250
|
+
const dts = emittedContentMap.get(ambientFile);
|
|
251
|
+
if (dts) {
|
|
252
|
+
const cleaned = dts.replace(/\/\/# sourceMappingURL=.*$/m, "").trim();
|
|
253
|
+
if (cleaned) code += `\n\n${formatTypes(cleaned)}`;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
code = await (0, utils_exports.format)(context, context.typesPath, code);
|
|
257
|
+
context.debug(`A TypeScript declaration file (size: ${prettyBytes(new Blob(toArray(code)).size)}) emitted for the built-in modules types.`);
|
|
145
258
|
return {
|
|
146
|
-
code
|
|
259
|
+
code,
|
|
147
260
|
directives
|
|
148
261
|
};
|
|
149
262
|
}
|
|
@@ -320,10 +433,11 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
320
433
|
api,
|
|
321
434
|
addPlugin: api.#addPlugin.bind(api)
|
|
322
435
|
};
|
|
436
|
+
const timer = api.context.timer("Initialization");
|
|
323
437
|
api.context.info(`🔌 The Powerlines Engine v${version} has started`);
|
|
324
438
|
for (const plugin of api.context.config.plugins.flat(10) ?? []) await api.#addPlugin(plugin);
|
|
325
439
|
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.");
|
|
326
|
-
else api.context.info(
|
|
440
|
+
else api.context.info(`Loaded ${api.context.plugins.length} ${titleCase(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, utils_exports.colorText)(plugin.name)}`).join("\n")}`);
|
|
327
441
|
const pluginConfig = await api.callHook("config", {
|
|
328
442
|
environment: await api.context.getEnvironment(),
|
|
329
443
|
sequential: true,
|
|
@@ -331,6 +445,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
331
445
|
merge: mergeConfigs
|
|
332
446
|
});
|
|
333
447
|
await api.context.withUserConfig(pluginConfig, { isHighPriority: false });
|
|
448
|
+
timer();
|
|
334
449
|
return api;
|
|
335
450
|
}
|
|
336
451
|
/**
|
|
@@ -342,6 +457,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
342
457
|
* @param inlineConfig - The inline configuration for the types command
|
|
343
458
|
*/
|
|
344
459
|
async types(inlineConfig = { command: "types" }) {
|
|
460
|
+
const timer = this.context.timer("Types");
|
|
345
461
|
this.context.info(" 🏗️ Generating typescript declarations for the Powerlines project");
|
|
346
462
|
this.context.debug(" Aggregating configuration options for the Powerlines project");
|
|
347
463
|
inlineConfig.command ??= "types";
|
|
@@ -385,6 +501,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
385
501
|
context.persistedMeta = context.meta;
|
|
386
502
|
});
|
|
387
503
|
this.context.debug("✔ Powerlines types generation has completed successfully");
|
|
504
|
+
timer();
|
|
388
505
|
}
|
|
389
506
|
/**
|
|
390
507
|
* Prepare the Powerlines API
|
|
@@ -395,6 +512,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
395
512
|
* @param inlineConfig - The inline configuration for the prepare command
|
|
396
513
|
*/
|
|
397
514
|
async prepare(inlineConfig = { command: "prepare" }) {
|
|
515
|
+
const timer = this.context.timer("Prepare");
|
|
398
516
|
this.context.info(" 🏗️ Preparing the Powerlines project");
|
|
399
517
|
this.context.debug(" Aggregating configuration options for the Powerlines project");
|
|
400
518
|
inlineConfig.command ??= "prepare";
|
|
@@ -445,6 +563,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
445
563
|
context.persistedMeta = context.meta;
|
|
446
564
|
});
|
|
447
565
|
this.context.debug("✔ Powerlines preparation has completed successfully");
|
|
566
|
+
timer();
|
|
448
567
|
}
|
|
449
568
|
/**
|
|
450
569
|
* Create a new Powerlines project
|
|
@@ -456,6 +575,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
456
575
|
* @returns A promise that resolves when the project has been created
|
|
457
576
|
*/
|
|
458
577
|
async new(inlineConfig) {
|
|
578
|
+
const timer = this.context.timer("New");
|
|
459
579
|
this.context.info(" 🆕 Creating a new Powerlines project");
|
|
460
580
|
inlineConfig.command ??= "new";
|
|
461
581
|
await this.prepare(inlineConfig);
|
|
@@ -496,6 +616,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
496
616
|
});
|
|
497
617
|
});
|
|
498
618
|
this.context.debug("✔ Powerlines new command completed successfully");
|
|
619
|
+
timer();
|
|
499
620
|
}
|
|
500
621
|
/**
|
|
501
622
|
* Clean any previously prepared artifacts
|
|
@@ -507,6 +628,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
507
628
|
* @returns A promise that resolves when the clean command has completed
|
|
508
629
|
*/
|
|
509
630
|
async clean(inlineConfig = { command: "clean" }) {
|
|
631
|
+
const timer = this.context.timer("Clean");
|
|
510
632
|
this.context.info(" 🧹 Cleaning the previous Powerlines artifacts");
|
|
511
633
|
inlineConfig.command ??= "clean";
|
|
512
634
|
await this.prepare(inlineConfig);
|
|
@@ -520,6 +642,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
520
642
|
});
|
|
521
643
|
});
|
|
522
644
|
this.context.debug("✔ Powerlines cleaning completed successfully");
|
|
645
|
+
timer();
|
|
523
646
|
}
|
|
524
647
|
/**
|
|
525
648
|
* Lint the project
|
|
@@ -528,6 +651,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
528
651
|
* @returns A promise that resolves when the lint command has completed
|
|
529
652
|
*/
|
|
530
653
|
async lint(inlineConfig = { command: "lint" }) {
|
|
654
|
+
const timer = this.context.timer("Lint");
|
|
531
655
|
this.context.info(" 📝 Linting the Powerlines project");
|
|
532
656
|
inlineConfig.command ??= "lint";
|
|
533
657
|
await this.prepare(inlineConfig);
|
|
@@ -538,6 +662,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
538
662
|
});
|
|
539
663
|
});
|
|
540
664
|
this.context.debug("✔ Powerlines linting completed successfully");
|
|
665
|
+
timer();
|
|
541
666
|
}
|
|
542
667
|
/**
|
|
543
668
|
* Build the project
|
|
@@ -549,6 +674,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
549
674
|
* @returns A promise that resolves when the build command has completed
|
|
550
675
|
*/
|
|
551
676
|
async build(inlineConfig = { command: "build" }) {
|
|
677
|
+
const timer = this.context.timer("Build");
|
|
552
678
|
this.context.info(" 📦 Building the Powerlines project");
|
|
553
679
|
await this.context.generateChecksum();
|
|
554
680
|
if (this.context.meta.checksum !== this.context.persistedMeta?.checksum || this.context.config.skipCache) {
|
|
@@ -561,6 +687,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
561
687
|
await this.#handleBuild(context);
|
|
562
688
|
});
|
|
563
689
|
this.context.debug("✔ Powerlines build completed successfully");
|
|
690
|
+
timer();
|
|
564
691
|
}
|
|
565
692
|
/**
|
|
566
693
|
* Prepare the documentation for the project
|
|
@@ -569,6 +696,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
569
696
|
* @returns A promise that resolves when the documentation generation has completed
|
|
570
697
|
*/
|
|
571
698
|
async docs(inlineConfig = { command: "docs" }) {
|
|
699
|
+
const timer = this.context.timer("Docs");
|
|
572
700
|
this.context.info(" 📓 Generating documentation for the Powerlines project");
|
|
573
701
|
inlineConfig.command ??= "docs";
|
|
574
702
|
await this.prepare(inlineConfig);
|
|
@@ -581,6 +709,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
581
709
|
});
|
|
582
710
|
});
|
|
583
711
|
this.context.debug("✔ Powerlines documentation generation completed successfully");
|
|
712
|
+
timer();
|
|
584
713
|
}
|
|
585
714
|
/**
|
|
586
715
|
* Deploy the project source code
|
|
@@ -591,6 +720,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
591
720
|
* @param inlineConfig - The inline configuration for the deploy command
|
|
592
721
|
*/
|
|
593
722
|
async deploy(inlineConfig = { command: "deploy" }) {
|
|
723
|
+
const timer = this.context.timer("Deploy");
|
|
594
724
|
this.context.info(" 🚀 Deploying the Powerlines project");
|
|
595
725
|
inlineConfig.command ??= "deploy";
|
|
596
726
|
await this.prepare(inlineConfig);
|
|
@@ -598,9 +728,10 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
598
728
|
await this.callHook("deploy", { environment: context });
|
|
599
729
|
});
|
|
600
730
|
this.context.debug("✔ Powerlines deploy completed successfully");
|
|
731
|
+
timer();
|
|
601
732
|
}
|
|
602
733
|
/**
|
|
603
|
-
* Finalization
|
|
734
|
+
* Finalization/cleanup processing for the Powerlines API
|
|
604
735
|
*
|
|
605
736
|
* @remarks
|
|
606
737
|
* This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
|
|
@@ -608,6 +739,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
608
739
|
* @returns A promise that resolves when the finalization process has completed
|
|
609
740
|
*/
|
|
610
741
|
async finalize() {
|
|
742
|
+
const timer = this.context.timer("Finalization");
|
|
611
743
|
this.context.info(" 🏁 Powerlines finalization processes started");
|
|
612
744
|
await this.#executeEnvironments(async (context) => {
|
|
613
745
|
await this.callHook("finalize", { environment: context });
|
|
@@ -615,6 +747,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
615
747
|
if (existsSync(context.cachePath) && !(await listFiles(joinPaths(context.cachePath, "**/*")))?.length) await removeDirectory(context.cachePath);
|
|
616
748
|
});
|
|
617
749
|
this.context.debug("✔ Powerlines finalization completed successfully");
|
|
750
|
+
timer();
|
|
618
751
|
}
|
|
619
752
|
/**
|
|
620
753
|
* Invokes the configured plugin hooks
|
|
@@ -764,7 +897,7 @@ var PowerlinesAPI = class PowerlinesAPI {
|
|
|
764
897
|
if (!plugins) throw new Error(`The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`);
|
|
765
898
|
if (plugins.length > 0 && !plugins.every(plugin_utils_exports.isPlugin)) throw new Error(`The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);
|
|
766
899
|
const result = [];
|
|
767
|
-
for (const plugin of plugins) if ((0, plugin_utils_exports.
|
|
900
|
+
for (const plugin of plugins) if ((0, plugin_utils_exports.isDuplicate)(plugin, this.context.plugins)) this.context.trace(`Duplicate ${chalk.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
768
901
|
else {
|
|
769
902
|
result.push(plugin);
|
|
770
903
|
this.context.trace(`Initializing the ${chalk.bold.cyanBright(plugin.name)} plugin...`);
|
|
@@ -894,4 +1027,4 @@ ${formatTypes(code)}
|
|
|
894
1027
|
|
|
895
1028
|
//#endregion
|
|
896
1029
|
export { name as n, version as r, PowerlinesAPI as t };
|
|
897
|
-
//# sourceMappingURL=api-
|
|
1030
|
+
//# sourceMappingURL=api-DBPe7xMz.mjs.map
|