powerlines 0.37.30 → 0.37.32
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.cjs +2 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.js +3 -3
- package/dist/{chunk-RGBI7UX7.cjs → chunk-3ZV6MOMH.cjs} +173 -216
- package/dist/{chunk-4JQPEMXH.js → chunk-D5W4OJQI.js} +3 -3
- package/dist/{chunk-YL3OE2WO.js → chunk-DFHVFK5Q.js} +160 -205
- package/dist/{chunk-QXPCHWBR.js → chunk-DJ4FRBNH.js} +3 -3
- package/dist/{chunk-2CQDJX6M.js → chunk-MJ7BK6OR.js} +3 -3
- package/dist/{chunk-52KPCXIK.cjs → chunk-OLOGZ27T.cjs} +5 -5
- package/dist/{chunk-5ENLYVSO.cjs → chunk-UO3UVXLR.cjs} +4 -4
- package/dist/{chunk-MQ6WRPXN.js → chunk-VURVUUYR.js} +3 -3
- package/dist/chunk-WD2SDIXV.cjs +12 -0
- package/dist/{chunk-NJHY3UUE.cjs → chunk-XR4OJDFT.cjs} +4 -4
- package/dist/chunk-XZI5Z56Q.cjs +12 -0
- package/dist/{chunk-E6S3W74I.js → chunk-Z4HHHZMP.js} +3 -3
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.js +2 -2
- package/dist/index.cjs +10 -10
- package/dist/index.js +2 -2
- package/dist/lib/build/esbuild.cjs +5 -5
- package/dist/lib/build/esbuild.js +2 -2
- package/dist/lib/build/index.cjs +12 -12
- package/dist/lib/build/index.d.cts +1 -1
- package/dist/lib/build/index.d.ts +1 -1
- package/dist/lib/build/index.js +4 -4
- package/dist/lib/build/tsup.cjs +6 -6
- package/dist/lib/build/tsup.js +3 -3
- package/dist/lib/build/unbuild.d.cts +1 -1
- package/dist/lib/build/unbuild.d.ts +1 -1
- package/dist/lib/build/vite.cjs +5 -5
- package/dist/lib/build/vite.js +3 -3
- package/dist/lib/{chunk-IRY6M7JO.cjs → chunk-2J3BIEL5.cjs} +13 -89
- package/dist/lib/chunk-2J3BIEL5.cjs.map +1 -0
- package/dist/lib/{chunk-7CCOJFAV.js → chunk-2JWZTFXS.js} +4 -4
- package/dist/lib/{chunk-7CCOJFAV.js.map → chunk-2JWZTFXS.js.map} +1 -1
- package/dist/lib/{chunk-FSQATFTG.js → chunk-2NYU6PWO.js} +3 -3
- package/dist/lib/{chunk-FSQATFTG.js.map → chunk-2NYU6PWO.js.map} +1 -1
- package/dist/lib/{chunk-TFOAWLRF.js → chunk-2Q4HYRK6.js} +3 -3
- package/dist/lib/{chunk-TFOAWLRF.js.map → chunk-2Q4HYRK6.js.map} +1 -1
- package/dist/lib/{chunk-3DYPJHNF.js → chunk-5X6JDPCN.js} +3 -3
- package/dist/lib/{chunk-3DYPJHNF.js.map → chunk-5X6JDPCN.js.map} +1 -1
- package/dist/lib/{chunk-37QKQRHL.js → chunk-ABGPMB5O.js} +3 -3
- package/dist/lib/{chunk-37QKQRHL.js.map → chunk-ABGPMB5O.js.map} +1 -1
- package/dist/lib/{chunk-O7HKPUBS.cjs → chunk-BCRIAJHV.cjs} +4 -4
- package/dist/lib/{chunk-O7HKPUBS.cjs.map → chunk-BCRIAJHV.cjs.map} +1 -1
- package/dist/lib/{chunk-7ZLMFCZF.js → chunk-CQMZHDZP.js} +3 -3
- package/dist/lib/{chunk-7ZLMFCZF.js.map → chunk-CQMZHDZP.js.map} +1 -1
- package/dist/lib/{chunk-JD3NTKZV.cjs → chunk-HFM5IVGD.cjs} +39 -33
- package/dist/lib/chunk-HFM5IVGD.cjs.map +1 -0
- package/dist/lib/{chunk-AJ4BVNZQ.js → chunk-HX5UF7YV.js} +36 -30
- package/dist/lib/chunk-HX5UF7YV.js.map +1 -0
- package/dist/lib/{chunk-NLYJSUUY.cjs → chunk-JF4ZEC67.cjs} +19 -19
- package/dist/lib/{chunk-NLYJSUUY.cjs.map → chunk-JF4ZEC67.cjs.map} +1 -1
- package/dist/lib/{chunk-PD6TYAFZ.cjs → chunk-KCMW3IVY.cjs} +4 -4
- package/dist/lib/{chunk-PD6TYAFZ.cjs.map → chunk-KCMW3IVY.cjs.map} +1 -1
- package/dist/lib/{chunk-W2573LNZ.js → chunk-L3BXKH76.js} +51 -48
- package/dist/lib/chunk-L3BXKH76.js.map +1 -0
- package/dist/lib/{chunk-BCHMMSWE.cjs → chunk-LV5UDNR3.cjs} +75 -72
- package/dist/lib/chunk-LV5UDNR3.cjs.map +1 -0
- package/dist/lib/{chunk-KLU5DWCZ.js → chunk-N37JIOZ4.js} +28 -8
- package/dist/lib/chunk-N37JIOZ4.js.map +1 -0
- package/dist/lib/{chunk-HUWGH27W.cjs → chunk-N3CUVN4G.cjs} +4 -4
- package/dist/lib/{chunk-HUWGH27W.cjs.map → chunk-N3CUVN4G.cjs.map} +1 -1
- package/dist/lib/{chunk-TAHP4BEC.cjs → chunk-NAMUQY7P.cjs} +4 -4
- package/dist/lib/{chunk-TAHP4BEC.cjs.map → chunk-NAMUQY7P.cjs.map} +1 -1
- package/dist/lib/{chunk-NGM47YES.cjs → chunk-O3ZBMF6Z.cjs} +6 -6
- package/dist/lib/{chunk-NGM47YES.cjs.map → chunk-O3ZBMF6Z.cjs.map} +1 -1
- package/dist/lib/{chunk-QNGZB26V.cjs → chunk-V5I52KN4.cjs} +4 -4
- package/dist/lib/{chunk-QNGZB26V.cjs.map → chunk-V5I52KN4.cjs.map} +1 -1
- package/dist/lib/{chunk-LLHPKFHC.js → chunk-WQRK3BBU.js} +13 -89
- package/dist/lib/chunk-WQRK3BBU.js.map +1 -0
- package/dist/lib/{chunk-NFUIYX77.js → chunk-X6CZ2G2G.js} +3 -3
- package/dist/lib/{chunk-NFUIYX77.js.map → chunk-X6CZ2G2G.js.map} +1 -1
- package/dist/lib/{chunk-FQZQA4EJ.cjs → chunk-Y36HVRRL.cjs} +29 -7
- package/dist/lib/chunk-Y36HVRRL.cjs.map +1 -0
- package/dist/lib/contexts/api-context.cjs +6 -6
- package/dist/lib/contexts/api-context.d.cts +1 -1
- package/dist/lib/contexts/api-context.d.ts +1 -1
- package/dist/lib/contexts/api-context.js +5 -5
- package/dist/lib/contexts/context.cjs +4 -4
- package/dist/lib/contexts/context.d.cts +5 -5
- package/dist/lib/contexts/context.d.ts +5 -5
- package/dist/lib/contexts/context.js +3 -3
- package/dist/lib/contexts/environment-context.cjs +5 -5
- package/dist/lib/contexts/environment-context.d.cts +1 -1
- package/dist/lib/contexts/environment-context.d.ts +1 -1
- package/dist/lib/contexts/environment-context.js +4 -4
- package/dist/lib/contexts/index.cjs +8 -8
- package/dist/lib/contexts/index.d.cts +1 -1
- package/dist/lib/contexts/index.d.ts +1 -1
- package/dist/lib/contexts/index.js +5 -5
- package/dist/lib/contexts/plugin-context.d.cts +1 -1
- package/dist/lib/contexts/plugin-context.d.ts +1 -1
- package/dist/lib/entry.cjs +17 -9
- package/dist/lib/entry.d.cts +16 -2
- package/dist/lib/entry.d.ts +16 -2
- package/dist/lib/entry.js +1 -1
- package/dist/lib/fs/index.cjs +2 -2
- package/dist/lib/fs/index.js +1 -1
- package/dist/lib/fs/vfs.cjs +2 -2
- package/dist/lib/fs/vfs.js +1 -1
- package/dist/lib/index.cjs +32 -24
- package/dist/lib/index.d.cts +2 -2
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +9 -9
- package/dist/lib/{internal-DyXNBori.d.ts → internal-CFBs3Fok.d.cts} +1 -5
- package/dist/lib/{internal-Dt8PM9M2.d.cts → internal-Dlj-vo3a.d.ts} +1 -5
- package/dist/lib/unplugin/factory.cjs +7 -7
- package/dist/lib/unplugin/factory.js +6 -6
- package/dist/lib/unplugin/index.cjs +7 -7
- package/dist/lib/unplugin/index.js +6 -6
- package/dist/lib/utilities/bundle.cjs +4 -4
- package/dist/lib/utilities/bundle.js +3 -3
- package/dist/lib/utilities/index.cjs +6 -6
- package/dist/lib/utilities/index.js +4 -4
- package/dist/lib/utilities/resolve.cjs +5 -5
- package/dist/lib/utilities/resolve.js +4 -4
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +8 -13
- package/dist/nuxt.js +4 -9
- package/dist/rolldown.cjs +6 -6
- package/dist/rolldown.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.js +2 -2
- package/dist/tsdown.cjs +4 -4
- package/dist/tsdown.js +3 -3
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/types/internal.d.cts +1 -5
- package/dist/types/internal.d.ts +1 -5
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +8 -8
- package/dist/unplugin.js +4 -4
- package/dist/vite.cjs +6 -6
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.js +3 -3
- package/package.json +2 -2
- package/dist/chunk-7VPSEJKY.cjs +0 -12
- package/dist/chunk-MBOC2GGZ.cjs +0 -12
- package/dist/lib/chunk-AJ4BVNZQ.js.map +0 -1
- package/dist/lib/chunk-BCHMMSWE.cjs.map +0 -1
- package/dist/lib/chunk-FQZQA4EJ.cjs.map +0 -1
- package/dist/lib/chunk-IRY6M7JO.cjs.map +0 -1
- package/dist/lib/chunk-JD3NTKZV.cjs.map +0 -1
- package/dist/lib/chunk-KLU5DWCZ.js.map +0 -1
- package/dist/lib/chunk-LLHPKFHC.js.map +0 -1
- package/dist/lib/chunk-W2573LNZ.js.map +0 -1
|
@@ -3,7 +3,6 @@ import { BUILDER_VARIANTS, UNPLUGIN_BUILDER_VARIANTS } from './chunk-NITQ5IYP.js
|
|
|
3
3
|
import { __name } from './chunk-7QVYU63E.js';
|
|
4
4
|
import { transformAsync } from '@babel/core';
|
|
5
5
|
import { formatLogMessage } from '@storm-software/config-tools/logger/console';
|
|
6
|
-
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
7
6
|
import { toArray } from '@stryke/convert/to-array';
|
|
8
7
|
import { createDirectorySync, createDirectory } from '@stryke/fs/helpers';
|
|
9
8
|
import { install } from '@stryke/fs/install';
|
|
@@ -26,6 +25,7 @@ import chalk5 from 'chalk';
|
|
|
26
25
|
import Handlebars from 'handlebars';
|
|
27
26
|
import { declare } from '@babel/helper-plugin-utils';
|
|
28
27
|
import * as t from '@babel/types';
|
|
28
|
+
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
29
29
|
import ts, { flattenDiagnosticMessageText } from 'typescript';
|
|
30
30
|
import defu7, { createDefu, defu } from 'defu';
|
|
31
31
|
import { InMemoryFileSystemHost, Project } from 'ts-morph';
|
|
@@ -78,6 +78,11 @@ import { unlink } from 'node:fs/promises';
|
|
|
78
78
|
import { resolve } from 'node:path';
|
|
79
79
|
import '@stryke/fs/remove-file';
|
|
80
80
|
|
|
81
|
+
// package.json
|
|
82
|
+
var name = "powerlines";
|
|
83
|
+
var version = "0.37.31";
|
|
84
|
+
var package_default = {
|
|
85
|
+
version};
|
|
81
86
|
function resolveModulePath(nodePath, state) {
|
|
82
87
|
if (!t.isStringLiteral(nodePath.node)) {
|
|
83
88
|
return;
|
|
@@ -117,8 +122,8 @@ function matchesPattern(state, calleePath, pattern) {
|
|
|
117
122
|
if (!t.isIdentifier(node) || pattern.includes(".")) {
|
|
118
123
|
return false;
|
|
119
124
|
}
|
|
120
|
-
const
|
|
121
|
-
return node.name ===
|
|
125
|
+
const name2 = pattern.split(".")[0];
|
|
126
|
+
return node.name === name2;
|
|
122
127
|
}
|
|
123
128
|
__name(matchesPattern, "matchesPattern");
|
|
124
129
|
var importVisitors = {
|
|
@@ -452,13 +457,13 @@ async function installDependencies(context) {
|
|
|
452
457
|
}
|
|
453
458
|
context.log(LogLevelLabel.DEBUG, `The following packages are required:
|
|
454
459
|
Dependencies:
|
|
455
|
-
${Object.entries(context.dependencies).map(([
|
|
460
|
+
${Object.entries(context.dependencies).map(([name2, version2]) => `- ${name2}@${String(version2)}`).join(" \n")}
|
|
456
461
|
|
|
457
462
|
DevDependencies:
|
|
458
|
-
${Object.entries(context.devDependencies).map(([
|
|
463
|
+
${Object.entries(context.devDependencies).map(([name2, version2]) => `- ${name2}@${String(version2)}`).join(" \n")}`);
|
|
459
464
|
await Promise.all([
|
|
460
|
-
Promise.all(Object.entries(context.dependencies).map(async ([
|
|
461
|
-
Promise.all(Object.entries(context.devDependencies).map(async ([
|
|
465
|
+
Promise.all(Object.entries(context.dependencies).map(async ([name2, version2]) => installPackage(context, `${getPackageName(name2)}@${String(version2)}`, false))),
|
|
466
|
+
Promise.all(Object.entries(context.devDependencies).map(async ([name2, version2]) => installPackage(context, `${getPackageName(name2)}@${String(version2)}`, true)))
|
|
462
467
|
]);
|
|
463
468
|
}
|
|
464
469
|
__name(installDependencies, "installDependencies");
|
|
@@ -677,9 +682,9 @@ var DEFAULT_ENVIRONMENT = "default";
|
|
|
677
682
|
var GLOBAL_ENVIRONMENT = "__global__";
|
|
678
683
|
|
|
679
684
|
// src/internal/helpers/environment.ts
|
|
680
|
-
function createEnvironment(
|
|
681
|
-
return defu7(userConfig.environments?.[
|
|
682
|
-
name,
|
|
685
|
+
function createEnvironment(name2, userConfig) {
|
|
686
|
+
return defu7(userConfig.environments?.[name2] ?? {}, {
|
|
687
|
+
name: name2,
|
|
683
688
|
title: userConfig.title || titleCase(userConfig.name),
|
|
684
689
|
ssr: false,
|
|
685
690
|
mainFields: userConfig.build?.platform === "browser" ? [
|
|
@@ -907,19 +912,39 @@ function resolveEntry(context, typeDefinition) {
|
|
|
907
912
|
};
|
|
908
913
|
}
|
|
909
914
|
__name(resolveEntry, "resolveEntry");
|
|
915
|
+
function isTypeDefinition(entry) {
|
|
916
|
+
return !isString(entry) && entry.file !== void 0;
|
|
917
|
+
}
|
|
918
|
+
__name(isTypeDefinition, "isTypeDefinition");
|
|
919
|
+
function isResolvedEntryTypeDefinition(entry) {
|
|
920
|
+
return isTypeDefinition(entry) && entry.input !== void 0 && entry.output !== void 0;
|
|
921
|
+
}
|
|
922
|
+
__name(isResolvedEntryTypeDefinition, "isResolvedEntryTypeDefinition");
|
|
910
923
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
911
|
-
return typeDefinitions.map((entry) =>
|
|
912
|
-
|
|
913
|
-
|
|
924
|
+
return typeDefinitions.map((entry) => {
|
|
925
|
+
if (isResolvedEntryTypeDefinition(entry)) {
|
|
926
|
+
return {
|
|
927
|
+
...entry,
|
|
928
|
+
file: replacePathTokens(context, entry.file)
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
let typeDefinition;
|
|
932
|
+
if (isString(entry)) {
|
|
933
|
+
typeDefinition = parseTypeDefinition(replacePathTokens(context, entry));
|
|
934
|
+
} else {
|
|
935
|
+
typeDefinition = entry;
|
|
936
|
+
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
937
|
+
}
|
|
938
|
+
const filePath = appendPath(typeDefinition.file, context.config.projectRoot);
|
|
914
939
|
if (isFile(filePath)) {
|
|
915
940
|
return resolveEntry(context, {
|
|
916
941
|
file: replacePath(filePath, context.config.projectRoot),
|
|
917
|
-
name:
|
|
942
|
+
name: typeDefinition.name
|
|
918
943
|
});
|
|
919
944
|
}
|
|
920
945
|
return listFilesSync(filePath).map((file) => resolveEntry(context, {
|
|
921
946
|
file,
|
|
922
|
-
name:
|
|
947
|
+
name: typeDefinition.name
|
|
923
948
|
}));
|
|
924
949
|
}).flat().filter(Boolean);
|
|
925
950
|
}
|
|
@@ -1152,7 +1177,7 @@ FileMetadata._Properties = $.CompositeList(FileMetadata_KeyValuePair);
|
|
|
1152
1177
|
FileSystem._Ids = $.CompositeList(FileId);
|
|
1153
1178
|
FileSystem._Storage = $.CompositeList(FileStorage);
|
|
1154
1179
|
FileSystem._Metadata = $.CompositeList(FileMetadata);
|
|
1155
|
-
var createLog = /* @__PURE__ */ __name((
|
|
1180
|
+
var createLog = /* @__PURE__ */ __name((name2, options = {}) => {
|
|
1156
1181
|
const logLevel = options.logLevel === null ? LogLevelLabel.SILENT : options.logLevel || LogLevelLabel.INFO;
|
|
1157
1182
|
if (logLevel === LogLevelLabel.SILENT) {
|
|
1158
1183
|
return noop;
|
|
@@ -1163,7 +1188,7 @@ var createLog = /* @__PURE__ */ __name((name, options = {}) => {
|
|
|
1163
1188
|
return (type, ...args) => getLogFn(getLogLevel(type), {
|
|
1164
1189
|
...options,
|
|
1165
1190
|
logLevel
|
|
1166
|
-
})(`${chalk5.bold.hex(getColor("brand", options))(`${
|
|
1191
|
+
})(`${chalk5.bold.hex(getColor("brand", options))(`${name2 ? kebabCase(name2) : ""}${options.name ? `${name2 ? chalk5.gray(" > ") : ""}${kebabCase(options.name)}` : ""}${chalk5.gray(" > ")}`)}${args.join(" ")} `.trim());
|
|
1167
1192
|
}, "createLog");
|
|
1168
1193
|
var BADGE_COLORS = [
|
|
1169
1194
|
"#00A0DD",
|
|
@@ -1189,8 +1214,8 @@ var BADGE_COLORS = [
|
|
|
1189
1214
|
"#34D399",
|
|
1190
1215
|
"#8B5CF6"
|
|
1191
1216
|
];
|
|
1192
|
-
var extendLog = /* @__PURE__ */ __name((logFn,
|
|
1193
|
-
return (type, ...args) => logFn(type, ` ${chalk5.inverse.hex(BADGE_COLORS[
|
|
1217
|
+
var extendLog = /* @__PURE__ */ __name((logFn, name2) => {
|
|
1218
|
+
return (type, ...args) => logFn(type, ` ${chalk5.inverse.hex(BADGE_COLORS[name2.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${titleCase(name2)} `)} ${args.join(" ")} `);
|
|
1194
1219
|
}, "extendLog");
|
|
1195
1220
|
async function format(path, data) {
|
|
1196
1221
|
let code = data;
|
|
@@ -1849,12 +1874,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1849
1874
|
}
|
|
1850
1875
|
let metadata;
|
|
1851
1876
|
if (fs._hasMetadata()) {
|
|
1852
|
-
metadata = fs.metadata.find((meta) => meta.id === (id?.id ?? file.path));
|
|
1877
|
+
metadata = fs.metadata.find((meta) => meta.id === result.#normalizeId(id?.id ?? file.path));
|
|
1853
1878
|
}
|
|
1854
1879
|
await result.write(file.path, file.code, {
|
|
1855
1880
|
meta: {
|
|
1856
|
-
id: id?.id
|
|
1857
|
-
type: metadata?.type,
|
|
1881
|
+
id: result.#normalizeId(id?.id ?? metadata?.id ?? file.path),
|
|
1882
|
+
type: metadata?.type || "normal",
|
|
1858
1883
|
properties: metadata?._hasProperties() ? metadata?.properties.values().reduce((ret, kvp) => {
|
|
1859
1884
|
ret[kvp.key] = kvp.value;
|
|
1860
1885
|
return ret;
|
|
@@ -1865,37 +1890,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1865
1890
|
}
|
|
1866
1891
|
}));
|
|
1867
1892
|
}
|
|
1868
|
-
if (result.#metadata && Object.keys(result.#metadata).length > 0) {
|
|
1869
|
-
result.#log(LogLevelLabel.DEBUG, `Preparing to load ${Object.keys(result.#metadata).length} previously stored metadata records...`);
|
|
1870
|
-
const entry = Object.entries(result.#metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
1871
|
-
if (meta.properties) {
|
|
1872
|
-
const typeDefinition = {
|
|
1873
|
-
file: path
|
|
1874
|
-
};
|
|
1875
|
-
if (isSetString(meta.properties.name)) {
|
|
1876
|
-
typeDefinition.name = meta.properties.name;
|
|
1877
|
-
}
|
|
1878
|
-
if (isSetString(meta.properties["input.file"]) || isSetString(meta.properties["input.name"])) {
|
|
1879
|
-
typeDefinition.input ??= {};
|
|
1880
|
-
if (isSetString(meta.properties["input.file"])) {
|
|
1881
|
-
typeDefinition.input.file = meta.properties["input.file"];
|
|
1882
|
-
}
|
|
1883
|
-
if (isSetString(meta.properties["input.name"])) {
|
|
1884
|
-
typeDefinition.input.name = meta.properties["input.name"];
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
if (isSetString(meta.properties.output)) {
|
|
1888
|
-
typeDefinition.output = meta.properties.output;
|
|
1889
|
-
}
|
|
1890
|
-
return typeDefinition;
|
|
1891
|
-
}
|
|
1892
|
-
return null;
|
|
1893
|
-
}).filter(Boolean);
|
|
1894
|
-
result.#log(LogLevelLabel.DEBUG, `Loaded ${entry.length} entry type definitions from VFS metadata.`);
|
|
1895
|
-
context.entry = entry;
|
|
1896
|
-
} else {
|
|
1897
|
-
result.#log(LogLevelLabel.DEBUG, "No previously stored metadata records were found on the local system.");
|
|
1898
|
-
}
|
|
1899
1893
|
} else {
|
|
1900
1894
|
const message = new $.Message();
|
|
1901
1895
|
result = new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -1926,11 +1920,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1926
1920
|
}
|
|
1927
1921
|
let metadata;
|
|
1928
1922
|
if (fs._hasMetadata()) {
|
|
1929
|
-
metadata = fs.metadata.find((meta) => meta.id === (id?.id ?? file.path));
|
|
1923
|
+
metadata = fs.metadata.find((meta) => meta.id === result.#normalizeId(id?.id ?? file.path));
|
|
1930
1924
|
}
|
|
1931
1925
|
result.writeSync(file.path, file.code, {
|
|
1932
1926
|
meta: {
|
|
1933
|
-
id: id?.id
|
|
1927
|
+
id: result.#normalizeId(id?.id ?? metadata?.id ?? file.path),
|
|
1934
1928
|
type: metadata?.type,
|
|
1935
1929
|
properties: metadata?._hasProperties() ? metadata?.properties.values().reduce((ret, kvp) => {
|
|
1936
1930
|
ret[kvp.key] = kvp.value;
|
|
@@ -1942,37 +1936,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1942
1936
|
}
|
|
1943
1937
|
});
|
|
1944
1938
|
}
|
|
1945
|
-
if (result.#metadata && Object.keys(result.#metadata).length > 0) {
|
|
1946
|
-
result.#log(LogLevelLabel.DEBUG, `Preparing to load ${Object.keys(result.#metadata).length} previously stored metadata records...`);
|
|
1947
|
-
const entry = Object.entries(result.#metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
1948
|
-
if (meta.properties) {
|
|
1949
|
-
const typeDefinition = {
|
|
1950
|
-
file: path
|
|
1951
|
-
};
|
|
1952
|
-
if (isSetString(meta.properties.name)) {
|
|
1953
|
-
typeDefinition.name = meta.properties.name;
|
|
1954
|
-
}
|
|
1955
|
-
if (isSetString(meta.properties["input.file"]) || isSetString(meta.properties["input.name"])) {
|
|
1956
|
-
typeDefinition.input ??= {};
|
|
1957
|
-
if (isSetString(meta.properties["input.file"])) {
|
|
1958
|
-
typeDefinition.input.file = meta.properties["input.file"];
|
|
1959
|
-
}
|
|
1960
|
-
if (isSetString(meta.properties["input.name"])) {
|
|
1961
|
-
typeDefinition.input.name = meta.properties["input.name"];
|
|
1962
|
-
}
|
|
1963
|
-
}
|
|
1964
|
-
if (isSetString(meta.properties.output)) {
|
|
1965
|
-
typeDefinition.output = meta.properties.output;
|
|
1966
|
-
}
|
|
1967
|
-
return typeDefinition;
|
|
1968
|
-
}
|
|
1969
|
-
return null;
|
|
1970
|
-
}).filter(Boolean);
|
|
1971
|
-
result.#log(LogLevelLabel.DEBUG, `Loaded ${entry.length} entry type definitions from VFS metadata.`);
|
|
1972
|
-
context.entry = entry;
|
|
1973
|
-
} else {
|
|
1974
|
-
result.#log(LogLevelLabel.DEBUG, "No previously stored metadata records were found on the local system.");
|
|
1975
|
-
}
|
|
1976
1939
|
} else {
|
|
1977
1940
|
const message = new $.Message();
|
|
1978
1941
|
result = new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -2109,20 +2072,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2109
2072
|
};
|
|
2110
2073
|
return ret;
|
|
2111
2074
|
}, {});
|
|
2112
|
-
if (context.config.skipCache !== true) {
|
|
2113
|
-
Object.entries(this.#metadata).filter(([, value]) => value.type === "entry").forEach(([id, value]) => {
|
|
2114
|
-
this.#context.entry ??= [];
|
|
2115
|
-
this.#context.entry.push({
|
|
2116
|
-
file: id,
|
|
2117
|
-
name: value.properties.name,
|
|
2118
|
-
output: value.properties.output,
|
|
2119
|
-
input: value.properties["input.file"] ? {
|
|
2120
|
-
file: value.properties["input.file"],
|
|
2121
|
-
name: value.properties["input.name"]
|
|
2122
|
-
} : void 0
|
|
2123
|
-
});
|
|
2124
|
-
});
|
|
2125
|
-
}
|
|
2126
2075
|
}
|
|
2127
2076
|
this.#ids = {};
|
|
2128
2077
|
this.#paths = {};
|
|
@@ -2456,12 +2405,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2456
2405
|
*/
|
|
2457
2406
|
async read(path) {
|
|
2458
2407
|
const filePath = await this.resolve(path);
|
|
2459
|
-
if (!filePath) {
|
|
2408
|
+
if (!filePath || !this.existsSync(filePath)) {
|
|
2460
2409
|
return void 0;
|
|
2461
2410
|
}
|
|
2462
|
-
const {
|
|
2411
|
+
const { adapter } = this.#getStorage(filePath);
|
|
2463
2412
|
this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
|
|
2464
|
-
return await adapter.get(
|
|
2413
|
+
return await adapter.get(filePath) ?? void 0;
|
|
2465
2414
|
}
|
|
2466
2415
|
/**
|
|
2467
2416
|
* Synchronously reads a file from the virtual file system (VFS).
|
|
@@ -2471,12 +2420,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2471
2420
|
*/
|
|
2472
2421
|
readSync(path) {
|
|
2473
2422
|
const filePath = this.resolveSync(path);
|
|
2474
|
-
if (!filePath) {
|
|
2423
|
+
if (!filePath || !this.existsSync(filePath)) {
|
|
2475
2424
|
return void 0;
|
|
2476
2425
|
}
|
|
2477
|
-
const {
|
|
2426
|
+
const { adapter } = this.#getStorage(filePath);
|
|
2478
2427
|
this.#log(LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
|
|
2479
|
-
return adapter.getSync(
|
|
2428
|
+
return adapter.getSync(filePath) ?? void 0;
|
|
2480
2429
|
}
|
|
2481
2430
|
/**
|
|
2482
2431
|
* Writes a file to the virtual file system (VFS).
|
|
@@ -2816,8 +2765,8 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2816
2765
|
};
|
|
2817
2766
|
var PROJECT_ROOT_HASH_LENGTH = 45;
|
|
2818
2767
|
var CACHE_HASH_LENGTH = 62;
|
|
2819
|
-
function getPrefixedProjectRootHash(
|
|
2820
|
-
const combined = `${kebabCase(
|
|
2768
|
+
function getPrefixedProjectRootHash(name2, projectRootHash) {
|
|
2769
|
+
const combined = `${kebabCase(name2)}_${projectRootHash}`;
|
|
2821
2770
|
return combined.length > PROJECT_ROOT_HASH_LENGTH ? combined.slice(0, PROJECT_ROOT_HASH_LENGTH) : combined;
|
|
2822
2771
|
}
|
|
2823
2772
|
__name(getPrefixedProjectRootHash, "getPrefixedProjectRootHash");
|
|
@@ -2853,9 +2802,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2853
2802
|
*
|
|
2854
2803
|
* @internal
|
|
2855
2804
|
*/
|
|
2856
|
-
#internal = {
|
|
2857
|
-
entry: []
|
|
2858
|
-
};
|
|
2805
|
+
#internal = {};
|
|
2859
2806
|
#workspaceConfig;
|
|
2860
2807
|
#checksum = null;
|
|
2861
2808
|
#buildId = uuid();
|
|
@@ -2976,13 +2923,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2976
2923
|
* The resolved entry type definitions for the project
|
|
2977
2924
|
*/
|
|
2978
2925
|
get entry() {
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
/**
|
|
2982
|
-
* Sets the resolved entry type definitions for the project
|
|
2983
|
-
*/
|
|
2984
|
-
set entry(value) {
|
|
2985
|
-
this.$$internal.entry = value;
|
|
2926
|
+
const entry = this._entry;
|
|
2927
|
+
return resolveEntriesSync(this, !entry || entry.length === 0 ? toArray(this.config.entry) : entry);
|
|
2986
2928
|
}
|
|
2987
2929
|
/**
|
|
2988
2930
|
* The TypeScript configuration parsed from the tsconfig file
|
|
@@ -3182,6 +3124,35 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3182
3124
|
return this.#requestCache;
|
|
3183
3125
|
}
|
|
3184
3126
|
/**
|
|
3127
|
+
* The entry points that exist in the Powerlines virtual file system
|
|
3128
|
+
*/
|
|
3129
|
+
get _entry() {
|
|
3130
|
+
return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
3131
|
+
if (meta.properties) {
|
|
3132
|
+
const typeDefinition = {
|
|
3133
|
+
file: path
|
|
3134
|
+
};
|
|
3135
|
+
if (isSetString(meta.properties.name)) {
|
|
3136
|
+
typeDefinition.name = meta.properties.name;
|
|
3137
|
+
}
|
|
3138
|
+
if (isSetString(meta.properties["input.file"]) || isSetString(meta.properties["input.name"])) {
|
|
3139
|
+
typeDefinition.input ??= {};
|
|
3140
|
+
if (isSetString(meta.properties["input.file"])) {
|
|
3141
|
+
typeDefinition.input.file = meta.properties["input.file"];
|
|
3142
|
+
}
|
|
3143
|
+
if (isSetString(meta.properties["input.name"])) {
|
|
3144
|
+
typeDefinition.input.name = meta.properties["input.name"];
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
if (isSetString(meta.properties.output)) {
|
|
3148
|
+
typeDefinition.output = meta.properties.output;
|
|
3149
|
+
}
|
|
3150
|
+
return typeDefinition;
|
|
3151
|
+
}
|
|
3152
|
+
return void 0;
|
|
3153
|
+
}).filter(Boolean);
|
|
3154
|
+
}
|
|
3155
|
+
/**
|
|
3185
3156
|
* A function to perform HTTP fetch requests
|
|
3186
3157
|
*
|
|
3187
3158
|
* @remarks
|
|
@@ -3439,14 +3410,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3439
3410
|
*/
|
|
3440
3411
|
async emitEntry(code, path, options = {}) {
|
|
3441
3412
|
const entryPath = appendPath(replacePath(replacePath(replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
|
|
3442
|
-
if (this.$$internal.entry) {
|
|
3443
|
-
this.$$internal.entry.push({
|
|
3444
|
-
name: options.name,
|
|
3445
|
-
file: entryPath,
|
|
3446
|
-
input: options.input,
|
|
3447
|
-
output: options.output
|
|
3448
|
-
});
|
|
3449
|
-
}
|
|
3450
3413
|
return this.emit(code, entryPath, defu7({
|
|
3451
3414
|
meta: {
|
|
3452
3415
|
type: "entry",
|
|
@@ -3471,14 +3434,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3471
3434
|
*/
|
|
3472
3435
|
emitEntrySync(code, path, options = {}) {
|
|
3473
3436
|
const entryPath = appendPath(replacePath(replacePath(replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
|
|
3474
|
-
if (this.$$internal.entry) {
|
|
3475
|
-
this.$$internal.entry.push({
|
|
3476
|
-
name: options?.name,
|
|
3477
|
-
file: entryPath,
|
|
3478
|
-
input: options?.input,
|
|
3479
|
-
output: options?.output
|
|
3480
|
-
});
|
|
3481
|
-
}
|
|
3482
3437
|
return this.emitSync(code, entryPath, defu7({
|
|
3483
3438
|
meta: {
|
|
3484
3439
|
type: "entry",
|
|
@@ -3620,8 +3575,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3620
3575
|
* @param name - The name to use for the logger instance
|
|
3621
3576
|
* @returns A logger function
|
|
3622
3577
|
*/
|
|
3623
|
-
createLog(
|
|
3624
|
-
return createLog(
|
|
3578
|
+
createLog(name2 = null) {
|
|
3579
|
+
return createLog(name2, {
|
|
3625
3580
|
...this.config,
|
|
3626
3581
|
logLevel: isNull(this.config.logLevel) ? "silent" : this.config.logLevel
|
|
3627
3582
|
});
|
|
@@ -3632,8 +3587,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3632
3587
|
* @param name - The name to use for the extended logger instance
|
|
3633
3588
|
* @returns A logger function
|
|
3634
3589
|
*/
|
|
3635
|
-
extendLog(
|
|
3636
|
-
return extendLog(this.log,
|
|
3590
|
+
extendLog(name2) {
|
|
3591
|
+
return extendLog(this.log, name2);
|
|
3637
3592
|
}
|
|
3638
3593
|
/**
|
|
3639
3594
|
* Generates a checksum representing the current context state
|
|
@@ -4257,7 +4212,7 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4257
4212
|
*/
|
|
4258
4213
|
async init(config = {}) {
|
|
4259
4214
|
await super.init(config);
|
|
4260
|
-
await Promise.all(toArray(this.config.userConfig.environments && Object.keys(this.config.userConfig.environments).length > 0 ? Object.keys(this.config.userConfig.environments).map((
|
|
4215
|
+
await Promise.all(toArray(this.config.userConfig.environments && Object.keys(this.config.userConfig.environments).length > 0 ? Object.keys(this.config.userConfig.environments).map((name2) => createEnvironment(name2, this.config.userConfig)) : createDefaultEnvironment(this.config.userConfig)).map(async (env) => {
|
|
4261
4216
|
this.#environments[env.name] = await this.in(env);
|
|
4262
4217
|
}));
|
|
4263
4218
|
}
|
|
@@ -4293,8 +4248,8 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4293
4248
|
isHighPriority: true
|
|
4294
4249
|
}) {
|
|
4295
4250
|
await super.withUserConfig(userConfig, options);
|
|
4296
|
-
await Promise.all(Object.keys(this.#environments).map(async (
|
|
4297
|
-
await this.#environments[
|
|
4251
|
+
await Promise.all(Object.keys(this.#environments).map(async (name2) => {
|
|
4252
|
+
await this.#environments[name2].withUserConfig(userConfig, options);
|
|
4298
4253
|
}));
|
|
4299
4254
|
}
|
|
4300
4255
|
/**
|
|
@@ -4306,8 +4261,8 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4306
4261
|
isHighPriority: true
|
|
4307
4262
|
}) {
|
|
4308
4263
|
await super.withInlineConfig(inlineConfig, options);
|
|
4309
|
-
await Promise.all(Object.keys(this.#environments).map(async (
|
|
4310
|
-
await this.#environments[
|
|
4264
|
+
await Promise.all(Object.keys(this.#environments).map(async (name2) => {
|
|
4265
|
+
await this.#environments[name2].withInlineConfig(inlineConfig, options);
|
|
4311
4266
|
}));
|
|
4312
4267
|
}
|
|
4313
4268
|
/**
|
|
@@ -4317,8 +4272,8 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4317
4272
|
*/
|
|
4318
4273
|
async addPlugin(plugin) {
|
|
4319
4274
|
this.plugins.push(plugin);
|
|
4320
|
-
await Promise.all(Object.keys(this.environments).map(async (
|
|
4321
|
-
await this.environments[
|
|
4275
|
+
await Promise.all(Object.keys(this.environments).map(async (name2) => {
|
|
4276
|
+
await this.environments[name2].addPlugin(plugin);
|
|
4322
4277
|
}));
|
|
4323
4278
|
}
|
|
4324
4279
|
/**
|
|
@@ -4327,18 +4282,18 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4327
4282
|
* @param name - The name of the environment to retrieve.
|
|
4328
4283
|
* @returns The requested environment context.
|
|
4329
4284
|
*/
|
|
4330
|
-
async getEnvironment(
|
|
4285
|
+
async getEnvironment(name2) {
|
|
4331
4286
|
let environment;
|
|
4332
|
-
if (
|
|
4333
|
-
environment = this.environments[
|
|
4287
|
+
if (name2) {
|
|
4288
|
+
environment = this.environments[name2];
|
|
4334
4289
|
}
|
|
4335
4290
|
if (Object.keys(this.environments).length === 1) {
|
|
4336
4291
|
environment = this.environments[Object.keys(this.environments)[0]];
|
|
4337
4292
|
this.log(LogLevelLabel.DEBUG, `Applying the only configured environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
4338
4293
|
}
|
|
4339
4294
|
if (!environment) {
|
|
4340
|
-
if (
|
|
4341
|
-
throw new Error(`Environment "${
|
|
4295
|
+
if (name2) {
|
|
4296
|
+
throw new Error(`Environment "${name2}" not found.`);
|
|
4342
4297
|
}
|
|
4343
4298
|
environment = await this.in(createDefaultEnvironment(this.config.userConfig));
|
|
4344
4299
|
this.log(LogLevelLabel.WARN, `No environment specified, and no default environment found. Using a temporary default environment: ${chalk5.bold.cyanBright(environment?.environment.name)}`);
|
|
@@ -4351,9 +4306,9 @@ var PowerlinesAPIContext = class _PowerlinesAPIContext extends PowerlinesContext
|
|
|
4351
4306
|
* @param name - The name of the environment to retrieve.
|
|
4352
4307
|
* @returns The requested environment context or `undefined` if not found.
|
|
4353
4308
|
*/
|
|
4354
|
-
async getEnvironmentSafe(
|
|
4309
|
+
async getEnvironmentSafe(name2) {
|
|
4355
4310
|
try {
|
|
4356
|
-
return await this.getEnvironment(
|
|
4311
|
+
return await this.getEnvironment(name2);
|
|
4357
4312
|
} catch {
|
|
4358
4313
|
return void 0;
|
|
4359
4314
|
}
|
|
@@ -4432,14 +4387,14 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4432
4387
|
const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
|
|
4433
4388
|
api.#context.$$internal = {
|
|
4434
4389
|
api,
|
|
4435
|
-
addPlugin: api.#addPlugin.bind(api)
|
|
4436
|
-
entry: []
|
|
4390
|
+
addPlugin: api.#addPlugin.bind(api)
|
|
4437
4391
|
};
|
|
4392
|
+
api.context.info(`\u{1F50C} The Powerlines v${package_default.version} engine has started`);
|
|
4438
4393
|
for (const plugin of api.context.config.plugins ?? []) {
|
|
4439
4394
|
await api.#addPlugin(plugin);
|
|
4440
4395
|
}
|
|
4441
4396
|
if (api.context.plugins.length === 0) {
|
|
4442
|
-
api.context.
|
|
4397
|
+
api.context.warn("No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
|
|
4443
4398
|
}
|
|
4444
4399
|
const pluginConfig = await api.callHook("config", {
|
|
4445
4400
|
environment: await api.context.getEnvironment(),
|
|
@@ -4462,11 +4417,11 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4462
4417
|
async prepare(inlineConfig = {
|
|
4463
4418
|
command: "prepare"
|
|
4464
4419
|
}) {
|
|
4465
|
-
this.context.
|
|
4466
|
-
this.context.
|
|
4420
|
+
this.context.info(" \u{1F3D7}\uFE0F Preparing the Powerlines project");
|
|
4421
|
+
this.context.debug(" \u2699\uFE0F Aggregating configuration options for the Powerlines project");
|
|
4467
4422
|
await this.context.withInlineConfig(inlineConfig);
|
|
4468
4423
|
await this.#executeEnvironments(async (context) => {
|
|
4469
|
-
context.
|
|
4424
|
+
context.debug(`Initializing the processing options for the Powerlines project.`);
|
|
4470
4425
|
await this.callHook("configResolved", {
|
|
4471
4426
|
environment: context,
|
|
4472
4427
|
order: "pre"
|
|
@@ -4476,7 +4431,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4476
4431
|
environment: context,
|
|
4477
4432
|
order: "normal"
|
|
4478
4433
|
});
|
|
4479
|
-
context.
|
|
4434
|
+
context.debug(`The configuration provided ${toArray(context.config.entry).length} entry point(s), Powerlines has found ${context.entry.length} entry files(s) for the ${context.config.title} project${context.entry.length > 0 && context.entry.length < 10 ? `:
|
|
4480
4435
|
${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}.`);
|
|
4481
4436
|
await resolveTsconfig(context);
|
|
4482
4437
|
await installDependencies(context);
|
|
@@ -4484,7 +4439,7 @@ ${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.out
|
|
|
4484
4439
|
environment: context,
|
|
4485
4440
|
order: "post"
|
|
4486
4441
|
});
|
|
4487
|
-
context.
|
|
4442
|
+
context.trace(`Powerlines configuration has been resolved:
|
|
4488
4443
|
|
|
4489
4444
|
${formatLogMessage(context.config)}`);
|
|
4490
4445
|
if (!context.fs.existsSync(context.cachePath)) {
|
|
@@ -4502,11 +4457,11 @@ ${formatLogMessage(context.config)}`);
|
|
|
4502
4457
|
order: "normal"
|
|
4503
4458
|
});
|
|
4504
4459
|
if (context.config.output.dts !== false) {
|
|
4505
|
-
context.
|
|
4460
|
+
context.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
|
|
4506
4461
|
if (context.fs.existsSync(context.dtsPath)) {
|
|
4507
4462
|
await context.fs.remove(context.dtsPath);
|
|
4508
4463
|
}
|
|
4509
|
-
context.
|
|
4464
|
+
context.debug("Transforming built-ins runtime modules files.");
|
|
4510
4465
|
const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
|
|
4511
4466
|
const result2 = await transformAsync(file.code.toString(), {
|
|
4512
4467
|
highlightCode: true,
|
|
@@ -4539,7 +4494,7 @@ ${formatLogMessage(context.config)}`);
|
|
|
4539
4494
|
context.warn(`File ID is missing for a built-in runtime file at ${file.path}.`);
|
|
4540
4495
|
file.id = replacePath(replacePath(file.path, context.workspaceConfig.workspaceRoot), context.builtinsPath);
|
|
4541
4496
|
}
|
|
4542
|
-
context.
|
|
4497
|
+
context.trace(`Writing transformed built-in runtime file ${file.id}.`);
|
|
4543
4498
|
await context.emitBuiltin(result2.code, file.id);
|
|
4544
4499
|
return file.path;
|
|
4545
4500
|
}));
|
|
@@ -4558,9 +4513,9 @@ ${formatLogMessage(context.config)}`);
|
|
|
4558
4513
|
[]
|
|
4559
4514
|
// [joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")]
|
|
4560
4515
|
);
|
|
4561
|
-
context.
|
|
4516
|
+
context.debug("Parsing TypeScript configuration for the Powerlines project.");
|
|
4562
4517
|
let types = await emitTypes(context, files);
|
|
4563
|
-
context.
|
|
4518
|
+
context.debug(`Generating TypeScript declaration file ${context.dtsPath}.`);
|
|
4564
4519
|
const directives = [];
|
|
4565
4520
|
const asNextParam = /* @__PURE__ */ __name((previousResult) => isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
|
|
4566
4521
|
let result = await this.callHook("types", {
|
|
@@ -4637,7 +4592,7 @@ ${formatTypes(types)}
|
|
|
4637
4592
|
if (!context.tsconfig) {
|
|
4638
4593
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
4639
4594
|
}
|
|
4640
|
-
this.context.
|
|
4595
|
+
this.context.debug("Formatting files generated during the prepare step.");
|
|
4641
4596
|
await Promise.all([
|
|
4642
4597
|
formatFolder(context, context.builtinsPath),
|
|
4643
4598
|
formatFolder(context, context.entryPath)
|
|
@@ -4649,7 +4604,7 @@ ${formatTypes(types)}
|
|
|
4649
4604
|
await writeMetaFile(context);
|
|
4650
4605
|
context.persistedMeta = context.meta;
|
|
4651
4606
|
});
|
|
4652
|
-
this.context.
|
|
4607
|
+
this.context.info("\u2714 Powerlines preparation has completed successfully");
|
|
4653
4608
|
}
|
|
4654
4609
|
/**
|
|
4655
4610
|
* Create a new Powerlines project
|
|
@@ -4661,17 +4616,17 @@ ${formatTypes(types)}
|
|
|
4661
4616
|
* @returns A promise that resolves when the project has been created
|
|
4662
4617
|
*/
|
|
4663
4618
|
async new(inlineConfig) {
|
|
4664
|
-
this.context.
|
|
4619
|
+
this.context.info("\u{1F195} Creating a new Powerlines project");
|
|
4665
4620
|
await this.prepare(inlineConfig);
|
|
4666
4621
|
await this.#executeEnvironments(async (context) => {
|
|
4667
|
-
context.
|
|
4622
|
+
context.debug("Initializing the processing options for the Powerlines project.");
|
|
4668
4623
|
await this.callHook("new", {
|
|
4669
4624
|
environment: context,
|
|
4670
4625
|
order: "pre"
|
|
4671
4626
|
});
|
|
4672
4627
|
const files = await listFiles(joinPaths$1(context.powerlinesPath, "files/common/**/*.hbs"));
|
|
4673
4628
|
for (const file of files) {
|
|
4674
|
-
context.
|
|
4629
|
+
context.trace(`Adding template file to project: ${file}`);
|
|
4675
4630
|
const template = Handlebars.compile(file);
|
|
4676
4631
|
await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4677
4632
|
}
|
|
@@ -4682,14 +4637,14 @@ ${formatTypes(types)}
|
|
|
4682
4637
|
if (context.config.projectType === "application") {
|
|
4683
4638
|
const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/application/**/*.hbs"));
|
|
4684
4639
|
for (const file of files2) {
|
|
4685
|
-
context.
|
|
4640
|
+
context.trace(`Adding application template file: ${file}`);
|
|
4686
4641
|
const template = Handlebars.compile(file);
|
|
4687
4642
|
await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4688
4643
|
}
|
|
4689
4644
|
} else {
|
|
4690
4645
|
const files2 = await listFiles(joinPaths$1(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
4691
4646
|
for (const file of files2) {
|
|
4692
|
-
context.
|
|
4647
|
+
context.trace(`Adding library template file: ${file}`);
|
|
4693
4648
|
const template = Handlebars.compile(file);
|
|
4694
4649
|
await context.fs.write(joinPaths$1(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4695
4650
|
}
|
|
@@ -4699,7 +4654,7 @@ ${formatTypes(types)}
|
|
|
4699
4654
|
order: "post"
|
|
4700
4655
|
});
|
|
4701
4656
|
});
|
|
4702
|
-
this.context.
|
|
4657
|
+
this.context.debug("\u2714 Powerlines new command completed successfully");
|
|
4703
4658
|
}
|
|
4704
4659
|
/**
|
|
4705
4660
|
* Clean any previously prepared artifacts
|
|
@@ -4713,10 +4668,10 @@ ${formatTypes(types)}
|
|
|
4713
4668
|
async clean(inlineConfig = {
|
|
4714
4669
|
command: "clean"
|
|
4715
4670
|
}) {
|
|
4716
|
-
this.context.
|
|
4671
|
+
this.context.info("\u{1F9F9} Cleaning the previous Powerlines artifacts");
|
|
4717
4672
|
await this.prepare(inlineConfig);
|
|
4718
4673
|
await this.#executeEnvironments(async (context) => {
|
|
4719
|
-
|
|
4674
|
+
context.debug("Cleaning the project's dist and artifacts directories.");
|
|
4720
4675
|
await context.fs.remove(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
|
|
4721
4676
|
await context.fs.remove(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.output.artifactsPath));
|
|
4722
4677
|
await this.callHook("clean", {
|
|
@@ -4724,7 +4679,7 @@ ${formatTypes(types)}
|
|
|
4724
4679
|
sequential: false
|
|
4725
4680
|
});
|
|
4726
4681
|
});
|
|
4727
|
-
this.context.
|
|
4682
|
+
this.context.debug("\u2714 Powerlines cleaning completed successfully");
|
|
4728
4683
|
}
|
|
4729
4684
|
/**
|
|
4730
4685
|
* Lint the project
|
|
@@ -4735,7 +4690,7 @@ ${formatTypes(types)}
|
|
|
4735
4690
|
async lint(inlineConfig = {
|
|
4736
4691
|
command: "lint"
|
|
4737
4692
|
}) {
|
|
4738
|
-
this.context.
|
|
4693
|
+
this.context.info("\u{1F4CB} Linting the Powerlines project");
|
|
4739
4694
|
await this.prepare(inlineConfig);
|
|
4740
4695
|
await this.#executeEnvironments(async (context) => {
|
|
4741
4696
|
if (context.config.lint !== false) {
|
|
@@ -4745,7 +4700,7 @@ ${formatTypes(types)}
|
|
|
4745
4700
|
});
|
|
4746
4701
|
}
|
|
4747
4702
|
});
|
|
4748
|
-
this.context.
|
|
4703
|
+
this.context.debug("\u2714 Powerlines linting completed successfully");
|
|
4749
4704
|
}
|
|
4750
4705
|
/**
|
|
4751
4706
|
* Build the project
|
|
@@ -4759,7 +4714,7 @@ ${formatTypes(types)}
|
|
|
4759
4714
|
async build(inlineConfig = {
|
|
4760
4715
|
command: "build"
|
|
4761
4716
|
}) {
|
|
4762
|
-
this.context.
|
|
4717
|
+
this.context.info("\u{1F4E6} Building the Powerlines project");
|
|
4763
4718
|
await this.prepare(inlineConfig);
|
|
4764
4719
|
if (this.context.config.singleBuild) {
|
|
4765
4720
|
await this.#handleBuild(await this.#context.toEnvironment());
|
|
@@ -4768,7 +4723,7 @@ ${formatTypes(types)}
|
|
|
4768
4723
|
await this.#handleBuild(context);
|
|
4769
4724
|
});
|
|
4770
4725
|
}
|
|
4771
|
-
this.context.
|
|
4726
|
+
this.context.debug("\u2714 Powerlines build completed successfully");
|
|
4772
4727
|
}
|
|
4773
4728
|
/**
|
|
4774
4729
|
* Prepare the documentation for the project
|
|
@@ -4779,10 +4734,10 @@ ${formatTypes(types)}
|
|
|
4779
4734
|
async docs(inlineConfig = {
|
|
4780
4735
|
command: "docs"
|
|
4781
4736
|
}) {
|
|
4782
|
-
this.context.
|
|
4737
|
+
this.context.info("\u{1F4D3} Generating documentation for the Powerlines project");
|
|
4783
4738
|
await this.prepare(inlineConfig);
|
|
4784
4739
|
await this.#executeEnvironments(async (context) => {
|
|
4785
|
-
context.
|
|
4740
|
+
context.debug("Writing documentation for the Powerlines project artifacts.");
|
|
4786
4741
|
await this.prepare(inlineConfig);
|
|
4787
4742
|
await this.#executeEnvironments(async (context2) => {
|
|
4788
4743
|
await this.callHook("docs", {
|
|
@@ -4790,7 +4745,7 @@ ${formatTypes(types)}
|
|
|
4790
4745
|
});
|
|
4791
4746
|
});
|
|
4792
4747
|
});
|
|
4793
|
-
this
|
|
4748
|
+
this.context.debug("\u2714 Powerlines documentation generation completed successfully");
|
|
4794
4749
|
}
|
|
4795
4750
|
/**
|
|
4796
4751
|
* Deploy the project source code
|
|
@@ -4803,14 +4758,14 @@ ${formatTypes(types)}
|
|
|
4803
4758
|
async deploy(inlineConfig = {
|
|
4804
4759
|
command: "deploy"
|
|
4805
4760
|
}) {
|
|
4806
|
-
this.context.
|
|
4761
|
+
this.context.info("\u{1F680} Deploying the Powerlines project");
|
|
4807
4762
|
await this.prepare(inlineConfig);
|
|
4808
4763
|
await this.#executeEnvironments(async (context) => {
|
|
4809
4764
|
await this.callHook("deploy", {
|
|
4810
4765
|
environment: context
|
|
4811
4766
|
});
|
|
4812
4767
|
});
|
|
4813
|
-
this.context.
|
|
4768
|
+
this.context.debug("\u2714 Powerlines deploy completed successfully");
|
|
4814
4769
|
}
|
|
4815
4770
|
/**
|
|
4816
4771
|
* Finalization process
|
|
@@ -4821,14 +4776,14 @@ ${formatTypes(types)}
|
|
|
4821
4776
|
* @returns A promise that resolves when the finalization process has completed
|
|
4822
4777
|
*/
|
|
4823
4778
|
async finalize() {
|
|
4824
|
-
this.context.
|
|
4779
|
+
this.context.info("\u{1F3C1} Powerlines finalization processes started");
|
|
4825
4780
|
await this.#executeEnvironments(async (context) => {
|
|
4826
4781
|
await this.callHook("finalize", {
|
|
4827
4782
|
environment: context
|
|
4828
4783
|
});
|
|
4829
4784
|
await context.fs.dispose();
|
|
4830
4785
|
});
|
|
4831
|
-
this.context.
|
|
4786
|
+
this.context.debug("\u2714 Powerlines finalization completed successfully");
|
|
4832
4787
|
}
|
|
4833
4788
|
/**
|
|
4834
4789
|
* Invokes the configured plugin hooks
|
|
@@ -4869,12 +4824,12 @@ ${formatTypes(types)}
|
|
|
4869
4824
|
const sourcePath = appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot);
|
|
4870
4825
|
const destinationPath = joinPaths$1(appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
|
|
4871
4826
|
if (context.fs.existsSync(sourcePath) && sourcePath !== destinationPath) {
|
|
4872
|
-
context.
|
|
4827
|
+
context.debug(`Copying build output files from project's build directory (${context.config.output.buildPath}) to the workspace's output directory (${context.config.output.outputPath}).`);
|
|
4873
4828
|
await context.fs.copy(sourcePath, destinationPath);
|
|
4874
4829
|
}
|
|
4875
4830
|
}
|
|
4876
4831
|
await Promise.all(context.config.output.assets.map(async (asset) => {
|
|
4877
|
-
context.
|
|
4832
|
+
context.trace(`Copying asset(s): ${chalk5.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths$1(replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5.greenBright(joinPaths$1(replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5.yellowBright(i)).join(", ")})` : ""}`);
|
|
4878
4833
|
await context.fs.copy(asset, asset.output);
|
|
4879
4834
|
}));
|
|
4880
4835
|
await this.callHook("build", {
|
|
@@ -4889,23 +4844,23 @@ ${formatTypes(types)}
|
|
|
4889
4844
|
*/
|
|
4890
4845
|
async #getEnvironments() {
|
|
4891
4846
|
if (!this.context.config.environments || Object.keys(this.context.config.environments).length <= 1) {
|
|
4892
|
-
this.context.
|
|
4847
|
+
this.context.debug("No environments are configured for this Powerlines project. Using the default environment.");
|
|
4893
4848
|
return [
|
|
4894
4849
|
await this.context.getEnvironment()
|
|
4895
4850
|
];
|
|
4896
4851
|
}
|
|
4897
|
-
this.context.
|
|
4898
|
-
return (await Promise.all(Object.entries(this.context.config.environments).map(async ([
|
|
4899
|
-
const environment = await this.context.getEnvironmentSafe(
|
|
4852
|
+
this.context.debug(`Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`);
|
|
4853
|
+
return (await Promise.all(Object.entries(this.context.config.environments).map(async ([name2, config]) => {
|
|
4854
|
+
const environment = await this.context.getEnvironmentSafe(name2);
|
|
4900
4855
|
if (!environment) {
|
|
4901
4856
|
const resolvedEnvironment = await this.callHook("configEnvironment", {
|
|
4902
|
-
environment:
|
|
4903
|
-
},
|
|
4857
|
+
environment: name2
|
|
4858
|
+
}, name2, config);
|
|
4904
4859
|
if (resolvedEnvironment) {
|
|
4905
|
-
this.context.environments[
|
|
4860
|
+
this.context.environments[name2] = await this.context.in(resolvedEnvironment);
|
|
4906
4861
|
}
|
|
4907
4862
|
}
|
|
4908
|
-
return this.context.environments[
|
|
4863
|
+
return this.context.environments[name2];
|
|
4909
4864
|
}))).filter((context) => isSet(context));
|
|
4910
4865
|
}
|
|
4911
4866
|
/**
|
|
@@ -4930,7 +4885,7 @@ ${formatTypes(types)}
|
|
|
4930
4885
|
return;
|
|
4931
4886
|
}
|
|
4932
4887
|
for (const plugin of result) {
|
|
4933
|
-
this.context.
|
|
4888
|
+
this.context.debug(`Successfully initialized the ${chalk5.bold.cyanBright(plugin.name)} plugin`);
|
|
4934
4889
|
await this.context.addPlugin(plugin);
|
|
4935
4890
|
}
|
|
4936
4891
|
}
|
|
@@ -5017,10 +4972,10 @@ Please ensure the value is one of the following:
|
|
|
5017
4972
|
const result = [];
|
|
5018
4973
|
for (const plugin of plugins) {
|
|
5019
4974
|
if (checkDedupe(plugin, this.context.plugins)) {
|
|
5020
|
-
this.context.
|
|
4975
|
+
this.context.trace(`Duplicate ${chalk5.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
5021
4976
|
} else {
|
|
5022
4977
|
result.push(plugin);
|
|
5023
|
-
this.context.
|
|
4978
|
+
this.context.trace(`Initializing the ${chalk5.bold.cyanBright(plugin.name)} plugin...`);
|
|
5024
4979
|
}
|
|
5025
4980
|
}
|
|
5026
4981
|
return result;
|
|
@@ -5037,12 +4992,12 @@ Please ensure the value is one of the following:
|
|
|
5037
4992
|
]
|
|
5038
4993
|
});
|
|
5039
4994
|
if (!isInstalled && this.context.config.skipInstalls !== true) {
|
|
5040
|
-
this.#context.
|
|
4995
|
+
this.#context.warn(`The plugin package "${pluginPath}" is not installed. It will be installed automatically.`);
|
|
5041
4996
|
const result = await install(pluginPath, {
|
|
5042
4997
|
cwd: this.context.config.projectRoot
|
|
5043
4998
|
});
|
|
5044
4999
|
if (isNumber(result.exitCode) && result.exitCode > 0) {
|
|
5045
|
-
this.#context.
|
|
5000
|
+
this.#context.error(result.stderr);
|
|
5046
5001
|
throw new Error(`An error occurred while installing the build plugin package "${pluginPath}" `);
|
|
5047
5002
|
}
|
|
5048
5003
|
}
|
|
@@ -5075,6 +5030,6 @@ Note: Please ensure the plugin package's default export is a class that extends
|
|
|
5075
5030
|
}
|
|
5076
5031
|
};
|
|
5077
5032
|
|
|
5078
|
-
export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId, combineContexts, createLog, extendLog, isUnpluginBuilderVariant };
|
|
5079
|
-
//# sourceMappingURL=chunk-
|
|
5080
|
-
//# sourceMappingURL=chunk-
|
|
5033
|
+
export { FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, PowerlinesAPI, _capnpFileId, combineContexts, createLog, extendLog, isUnpluginBuilderVariant, name, version };
|
|
5034
|
+
//# sourceMappingURL=chunk-DFHVFK5Q.js.map
|
|
5035
|
+
//# sourceMappingURL=chunk-DFHVFK5Q.js.map
|