@powerlines/nx 0.11.87 → 0.11.89
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/CHANGELOG.md +12 -0
- package/dist/{chunk-JQQWHSDW.js → chunk-7XKSRDAW.js} +2 -2
- package/dist/{chunk-SKLNP5UN.mjs → chunk-BDNUU3BE.mjs} +1 -1
- package/dist/{chunk-ML2F77YJ.mjs → chunk-CAEN6BUA.mjs} +110 -157
- package/dist/{chunk-4XOSJQ2L.js → chunk-EC2PIJZV.js} +122 -169
- package/dist/{chunk-2EVSW3PI.mjs → chunk-GL3WER2K.mjs} +1 -1
- package/dist/{chunk-SHJFN377.js → chunk-HVQITMUW.js} +2 -2
- package/dist/{chunk-A6ZFPH2S.js → chunk-LPQFKWO2.js} +2 -2
- package/dist/{chunk-5CYEAIEZ.js → chunk-QUUIIQ7T.js} +2 -2
- package/dist/{chunk-CKLF6WS7.js → chunk-W2XT4AIC.js} +2 -2
- package/dist/{chunk-TISA64TJ.mjs → chunk-W3ZC4BPH.mjs} +1 -1
- package/dist/{chunk-EIQ37LFN.mjs → chunk-ZRX53Q2Y.mjs} +1 -1
- package/dist/{chunk-655IF4XR.mjs → chunk-ZS2VR33L.mjs} +1 -1
- package/dist/executors.js +11 -11
- package/dist/executors.mjs +6 -6
- package/dist/index.js +11 -11
- package/dist/index.mjs +6 -6
- package/dist/src/base/base-executor.js +2 -2
- package/dist/src/base/base-executor.mjs +1 -1
- package/dist/src/executors/build/executor.js +4 -4
- package/dist/src/executors/build/executor.mjs +2 -2
- package/dist/src/executors/clean/executor.js +4 -4
- package/dist/src/executors/clean/executor.mjs +2 -2
- package/dist/src/executors/docs/executor.js +4 -4
- package/dist/src/executors/docs/executor.mjs +2 -2
- package/dist/src/executors/lint/executor.js +4 -4
- package/dist/src/executors/lint/executor.mjs +2 -2
- package/dist/src/executors/prepare/executor.js +4 -4
- package/dist/src/executors/prepare/executor.mjs +2 -2
- package/package.json +3 -3
|
@@ -9,7 +9,6 @@ var defu6 = require('defu');
|
|
|
9
9
|
var getWorkspaceRoot = require('@stryke/fs/get-workspace-root');
|
|
10
10
|
var core = require('@babel/core');
|
|
11
11
|
var console = require('@storm-software/config-tools/logger/console');
|
|
12
|
-
var types = require('@storm-software/config-tools/types');
|
|
13
12
|
var toArray = require('@stryke/convert/to-array');
|
|
14
13
|
var helpers = require('@stryke/fs/helpers');
|
|
15
14
|
var install = require('@stryke/fs/install');
|
|
@@ -31,6 +30,7 @@ var chalk5 = require('chalk');
|
|
|
31
30
|
var Handlebars = require('handlebars');
|
|
32
31
|
var helperPluginUtils = require('@babel/helper-plugin-utils');
|
|
33
32
|
var t = require('@babel/types');
|
|
33
|
+
var types = require('@storm-software/config-tools/types');
|
|
34
34
|
var ts = require('typescript');
|
|
35
35
|
var tsMorph = require('ts-morph');
|
|
36
36
|
var _package = require('@stryke/string-format/package');
|
|
@@ -104,6 +104,9 @@ var t__namespace = /*#__PURE__*/_interopNamespace(t);
|
|
|
104
104
|
var ts__default = /*#__PURE__*/_interopDefault(ts);
|
|
105
105
|
var $__namespace = /*#__PURE__*/_interopNamespace($);
|
|
106
106
|
|
|
107
|
+
// ../powerlines/package.json
|
|
108
|
+
var package_default = {
|
|
109
|
+
version: "0.37.32"};
|
|
107
110
|
function resolveModulePath(nodePath, state) {
|
|
108
111
|
if (!t__namespace.isStringLiteral(nodePath.node)) {
|
|
109
112
|
return;
|
|
@@ -934,19 +937,39 @@ function resolveEntry(context, typeDefinition) {
|
|
|
934
937
|
};
|
|
935
938
|
}
|
|
936
939
|
chunkSHUYVCID_js.__name(resolveEntry, "resolveEntry");
|
|
940
|
+
function isTypeDefinition(entry) {
|
|
941
|
+
return !isString.isString(entry) && entry.file !== void 0;
|
|
942
|
+
}
|
|
943
|
+
chunkSHUYVCID_js.__name(isTypeDefinition, "isTypeDefinition");
|
|
944
|
+
function isResolvedEntryTypeDefinition(entry) {
|
|
945
|
+
return isTypeDefinition(entry) && entry.input !== void 0 && entry.output !== void 0;
|
|
946
|
+
}
|
|
947
|
+
chunkSHUYVCID_js.__name(isResolvedEntryTypeDefinition, "isResolvedEntryTypeDefinition");
|
|
937
948
|
function resolveEntriesSync(context, typeDefinitions) {
|
|
938
|
-
return typeDefinitions.map((entry) =>
|
|
939
|
-
|
|
940
|
-
|
|
949
|
+
return typeDefinitions.map((entry) => {
|
|
950
|
+
if (isResolvedEntryTypeDefinition(entry)) {
|
|
951
|
+
return {
|
|
952
|
+
...entry,
|
|
953
|
+
file: replacePathTokens(context, entry.file)
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
let typeDefinition;
|
|
957
|
+
if (isString.isString(entry)) {
|
|
958
|
+
typeDefinition = parseTypeDefinition.parseTypeDefinition(replacePathTokens(context, entry));
|
|
959
|
+
} else {
|
|
960
|
+
typeDefinition = entry;
|
|
961
|
+
typeDefinition.file = replacePathTokens(context, typeDefinition.file);
|
|
962
|
+
}
|
|
963
|
+
const filePath = append.appendPath(typeDefinition.file, context.config.projectRoot);
|
|
941
964
|
if (isFile.isFile(filePath)) {
|
|
942
965
|
return resolveEntry(context, {
|
|
943
966
|
file: replace.replacePath(filePath, context.config.projectRoot),
|
|
944
|
-
name:
|
|
967
|
+
name: typeDefinition.name
|
|
945
968
|
});
|
|
946
969
|
}
|
|
947
970
|
return listFiles.listFilesSync(filePath).map((file) => resolveEntry(context, {
|
|
948
971
|
file,
|
|
949
|
-
name:
|
|
972
|
+
name: typeDefinition.name
|
|
950
973
|
}));
|
|
951
974
|
}).flat().filter(Boolean);
|
|
952
975
|
}
|
|
@@ -1876,12 +1899,12 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1876
1899
|
}
|
|
1877
1900
|
let metadata;
|
|
1878
1901
|
if (fs._hasMetadata()) {
|
|
1879
|
-
metadata = fs.metadata.find((meta) => meta.id === (id?.id ?? file.path));
|
|
1902
|
+
metadata = fs.metadata.find((meta) => meta.id === result.#normalizeId(id?.id ?? file.path));
|
|
1880
1903
|
}
|
|
1881
1904
|
await result.write(file.path, file.code, {
|
|
1882
1905
|
meta: {
|
|
1883
|
-
id: id?.id
|
|
1884
|
-
type: metadata?.type,
|
|
1906
|
+
id: result.#normalizeId(id?.id ?? metadata?.id ?? file.path),
|
|
1907
|
+
type: metadata?.type || "normal",
|
|
1885
1908
|
properties: metadata?._hasProperties() ? metadata?.properties.values().reduce((ret, kvp) => {
|
|
1886
1909
|
ret[kvp.key] = kvp.value;
|
|
1887
1910
|
return ret;
|
|
@@ -1892,37 +1915,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1892
1915
|
}
|
|
1893
1916
|
}));
|
|
1894
1917
|
}
|
|
1895
|
-
if (result.#metadata && Object.keys(result.#metadata).length > 0) {
|
|
1896
|
-
result.#log(types.LogLevelLabel.DEBUG, `Preparing to load ${Object.keys(result.#metadata).length} previously stored metadata records...`);
|
|
1897
|
-
const entry = Object.entries(result.#metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
1898
|
-
if (meta.properties) {
|
|
1899
|
-
const typeDefinition = {
|
|
1900
|
-
file: path
|
|
1901
|
-
};
|
|
1902
|
-
if (isSetString.isSetString(meta.properties.name)) {
|
|
1903
|
-
typeDefinition.name = meta.properties.name;
|
|
1904
|
-
}
|
|
1905
|
-
if (isSetString.isSetString(meta.properties["input.file"]) || isSetString.isSetString(meta.properties["input.name"])) {
|
|
1906
|
-
typeDefinition.input ??= {};
|
|
1907
|
-
if (isSetString.isSetString(meta.properties["input.file"])) {
|
|
1908
|
-
typeDefinition.input.file = meta.properties["input.file"];
|
|
1909
|
-
}
|
|
1910
|
-
if (isSetString.isSetString(meta.properties["input.name"])) {
|
|
1911
|
-
typeDefinition.input.name = meta.properties["input.name"];
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
if (isSetString.isSetString(meta.properties.output)) {
|
|
1915
|
-
typeDefinition.output = meta.properties.output;
|
|
1916
|
-
}
|
|
1917
|
-
return typeDefinition;
|
|
1918
|
-
}
|
|
1919
|
-
return null;
|
|
1920
|
-
}).filter(Boolean);
|
|
1921
|
-
result.#log(types.LogLevelLabel.DEBUG, `Loaded ${entry.length} entry type definitions from VFS metadata.`);
|
|
1922
|
-
context.entry = entry;
|
|
1923
|
-
} else {
|
|
1924
|
-
result.#log(types.LogLevelLabel.DEBUG, "No previously stored metadata records were found on the local system.");
|
|
1925
|
-
}
|
|
1926
1918
|
} else {
|
|
1927
1919
|
const message = new $__namespace.Message();
|
|
1928
1920
|
result = new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -1953,11 +1945,11 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1953
1945
|
}
|
|
1954
1946
|
let metadata;
|
|
1955
1947
|
if (fs._hasMetadata()) {
|
|
1956
|
-
metadata = fs.metadata.find((meta) => meta.id === (id?.id ?? file.path));
|
|
1948
|
+
metadata = fs.metadata.find((meta) => meta.id === result.#normalizeId(id?.id ?? file.path));
|
|
1957
1949
|
}
|
|
1958
1950
|
result.writeSync(file.path, file.code, {
|
|
1959
1951
|
meta: {
|
|
1960
|
-
id: id?.id
|
|
1952
|
+
id: result.#normalizeId(id?.id ?? metadata?.id ?? file.path),
|
|
1961
1953
|
type: metadata?.type,
|
|
1962
1954
|
properties: metadata?._hasProperties() ? metadata?.properties.values().reduce((ret, kvp) => {
|
|
1963
1955
|
ret[kvp.key] = kvp.value;
|
|
@@ -1969,37 +1961,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
1969
1961
|
}
|
|
1970
1962
|
});
|
|
1971
1963
|
}
|
|
1972
|
-
if (result.#metadata && Object.keys(result.#metadata).length > 0) {
|
|
1973
|
-
result.#log(types.LogLevelLabel.DEBUG, `Preparing to load ${Object.keys(result.#metadata).length} previously stored metadata records...`);
|
|
1974
|
-
const entry = Object.entries(result.#metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
1975
|
-
if (meta.properties) {
|
|
1976
|
-
const typeDefinition = {
|
|
1977
|
-
file: path
|
|
1978
|
-
};
|
|
1979
|
-
if (isSetString.isSetString(meta.properties.name)) {
|
|
1980
|
-
typeDefinition.name = meta.properties.name;
|
|
1981
|
-
}
|
|
1982
|
-
if (isSetString.isSetString(meta.properties["input.file"]) || isSetString.isSetString(meta.properties["input.name"])) {
|
|
1983
|
-
typeDefinition.input ??= {};
|
|
1984
|
-
if (isSetString.isSetString(meta.properties["input.file"])) {
|
|
1985
|
-
typeDefinition.input.file = meta.properties["input.file"];
|
|
1986
|
-
}
|
|
1987
|
-
if (isSetString.isSetString(meta.properties["input.name"])) {
|
|
1988
|
-
typeDefinition.input.name = meta.properties["input.name"];
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
if (isSetString.isSetString(meta.properties.output)) {
|
|
1992
|
-
typeDefinition.output = meta.properties.output;
|
|
1993
|
-
}
|
|
1994
|
-
return typeDefinition;
|
|
1995
|
-
}
|
|
1996
|
-
return null;
|
|
1997
|
-
}).filter(Boolean);
|
|
1998
|
-
result.#log(types.LogLevelLabel.DEBUG, `Loaded ${entry.length} entry type definitions from VFS metadata.`);
|
|
1999
|
-
context.entry = entry;
|
|
2000
|
-
} else {
|
|
2001
|
-
result.#log(types.LogLevelLabel.DEBUG, "No previously stored metadata records were found on the local system.");
|
|
2002
|
-
}
|
|
2003
1964
|
} else {
|
|
2004
1965
|
const message = new $__namespace.Message();
|
|
2005
1966
|
result = new _VirtualFileSystem(context, message.initRoot(FileSystem));
|
|
@@ -2136,20 +2097,6 @@ var VirtualFileSystem = class _VirtualFileSystem {
|
|
|
2136
2097
|
};
|
|
2137
2098
|
return ret;
|
|
2138
2099
|
}, {});
|
|
2139
|
-
if (context.config.skipCache !== true) {
|
|
2140
|
-
Object.entries(this.#metadata).filter(([, value]) => value.type === "entry").forEach(([id, value]) => {
|
|
2141
|
-
this.#context.entry ??= [];
|
|
2142
|
-
this.#context.entry.push({
|
|
2143
|
-
file: id,
|
|
2144
|
-
name: value.properties.name,
|
|
2145
|
-
output: value.properties.output,
|
|
2146
|
-
input: value.properties["input.file"] ? {
|
|
2147
|
-
file: value.properties["input.file"],
|
|
2148
|
-
name: value.properties["input.name"]
|
|
2149
|
-
} : void 0
|
|
2150
|
-
});
|
|
2151
|
-
});
|
|
2152
|
-
}
|
|
2153
2100
|
}
|
|
2154
2101
|
this.#ids = {};
|
|
2155
2102
|
this.#paths = {};
|
|
@@ -2867,9 +2814,7 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2867
2814
|
*
|
|
2868
2815
|
* @internal
|
|
2869
2816
|
*/
|
|
2870
|
-
#internal = {
|
|
2871
|
-
entry: []
|
|
2872
|
-
};
|
|
2817
|
+
#internal = {};
|
|
2873
2818
|
#workspaceConfig;
|
|
2874
2819
|
#checksum = null;
|
|
2875
2820
|
#buildId = uuid.uuid();
|
|
@@ -2990,13 +2935,8 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
2990
2935
|
* The resolved entry type definitions for the project
|
|
2991
2936
|
*/
|
|
2992
2937
|
get entry() {
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
/**
|
|
2996
|
-
* Sets the resolved entry type definitions for the project
|
|
2997
|
-
*/
|
|
2998
|
-
set entry(value) {
|
|
2999
|
-
this.$$internal.entry = value;
|
|
2938
|
+
const entry = this._entry;
|
|
2939
|
+
return resolveEntriesSync(this, !entry || entry.length === 0 ? toArray.toArray(this.config.entry) : entry);
|
|
3000
2940
|
}
|
|
3001
2941
|
/**
|
|
3002
2942
|
* The TypeScript configuration parsed from the tsconfig file
|
|
@@ -3196,6 +3136,35 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3196
3136
|
return this.#requestCache;
|
|
3197
3137
|
}
|
|
3198
3138
|
/**
|
|
3139
|
+
* The entry points that exist in the Powerlines virtual file system
|
|
3140
|
+
*/
|
|
3141
|
+
get _entry() {
|
|
3142
|
+
return Object.entries(this.fs.metadata).filter(([, meta]) => meta && meta.type === "entry").map(([path, meta]) => {
|
|
3143
|
+
if (meta.properties) {
|
|
3144
|
+
const typeDefinition = {
|
|
3145
|
+
file: path
|
|
3146
|
+
};
|
|
3147
|
+
if (isSetString.isSetString(meta.properties.name)) {
|
|
3148
|
+
typeDefinition.name = meta.properties.name;
|
|
3149
|
+
}
|
|
3150
|
+
if (isSetString.isSetString(meta.properties["input.file"]) || isSetString.isSetString(meta.properties["input.name"])) {
|
|
3151
|
+
typeDefinition.input ??= {};
|
|
3152
|
+
if (isSetString.isSetString(meta.properties["input.file"])) {
|
|
3153
|
+
typeDefinition.input.file = meta.properties["input.file"];
|
|
3154
|
+
}
|
|
3155
|
+
if (isSetString.isSetString(meta.properties["input.name"])) {
|
|
3156
|
+
typeDefinition.input.name = meta.properties["input.name"];
|
|
3157
|
+
}
|
|
3158
|
+
}
|
|
3159
|
+
if (isSetString.isSetString(meta.properties.output)) {
|
|
3160
|
+
typeDefinition.output = meta.properties.output;
|
|
3161
|
+
}
|
|
3162
|
+
return typeDefinition;
|
|
3163
|
+
}
|
|
3164
|
+
return void 0;
|
|
3165
|
+
}).filter(Boolean);
|
|
3166
|
+
}
|
|
3167
|
+
/**
|
|
3199
3168
|
* A function to perform HTTP fetch requests
|
|
3200
3169
|
*
|
|
3201
3170
|
* @remarks
|
|
@@ -3453,14 +3422,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3453
3422
|
*/
|
|
3454
3423
|
async emitEntry(code, path, options = {}) {
|
|
3455
3424
|
const entryPath = append.appendPath(replace.replacePath(replace.replacePath(replace.replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
|
|
3456
|
-
if (this.$$internal.entry) {
|
|
3457
|
-
this.$$internal.entry.push({
|
|
3458
|
-
name: options.name,
|
|
3459
|
-
file: entryPath,
|
|
3460
|
-
input: options.input,
|
|
3461
|
-
output: options.output
|
|
3462
|
-
});
|
|
3463
|
-
}
|
|
3464
3425
|
return this.emit(code, entryPath, defu6__default.default({
|
|
3465
3426
|
meta: {
|
|
3466
3427
|
type: "entry",
|
|
@@ -3485,14 +3446,6 @@ var PowerlinesContext = class _PowerlinesContext {
|
|
|
3485
3446
|
*/
|
|
3486
3447
|
emitEntrySync(code, path, options = {}) {
|
|
3487
3448
|
const entryPath = append.appendPath(replace.replacePath(replace.replacePath(replace.replacePath(path, this.entryPath), this.config.projectRoot), this.workspaceConfig.workspaceRoot), this.entryPath);
|
|
3488
|
-
if (this.$$internal.entry) {
|
|
3489
|
-
this.$$internal.entry.push({
|
|
3490
|
-
name: options?.name,
|
|
3491
|
-
file: entryPath,
|
|
3492
|
-
input: options?.input,
|
|
3493
|
-
output: options?.output
|
|
3494
|
-
});
|
|
3495
|
-
}
|
|
3496
3449
|
return this.emitSync(code, entryPath, defu6__default.default({
|
|
3497
3450
|
meta: {
|
|
3498
3451
|
type: "entry",
|
|
@@ -4442,14 +4395,14 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4442
4395
|
const api = new _PowerlinesAPI(await PowerlinesAPIContext.from(workspaceRoot, config));
|
|
4443
4396
|
api.#context.$$internal = {
|
|
4444
4397
|
api,
|
|
4445
|
-
addPlugin: api.#addPlugin.bind(api)
|
|
4446
|
-
entry: []
|
|
4398
|
+
addPlugin: api.#addPlugin.bind(api)
|
|
4447
4399
|
};
|
|
4400
|
+
api.context.info(`\u{1F50C} The Powerlines v${package_default.version} engine has started`);
|
|
4448
4401
|
for (const plugin of api.context.config.plugins ?? []) {
|
|
4449
4402
|
await api.#addPlugin(plugin);
|
|
4450
4403
|
}
|
|
4451
4404
|
if (api.context.plugins.length === 0) {
|
|
4452
|
-
api.context.
|
|
4405
|
+
api.context.warn("No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended.");
|
|
4453
4406
|
}
|
|
4454
4407
|
const pluginConfig = await api.callHook("config", {
|
|
4455
4408
|
environment: await api.context.getEnvironment(),
|
|
@@ -4472,11 +4425,11 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4472
4425
|
async prepare(inlineConfig = {
|
|
4473
4426
|
command: "prepare"
|
|
4474
4427
|
}) {
|
|
4475
|
-
this.context.
|
|
4476
|
-
this.context.
|
|
4428
|
+
this.context.info(" \u{1F3D7}\uFE0F Preparing the Powerlines project");
|
|
4429
|
+
this.context.debug(" \u2699\uFE0F Aggregating configuration options for the Powerlines project");
|
|
4477
4430
|
await this.context.withInlineConfig(inlineConfig);
|
|
4478
4431
|
await this.#executeEnvironments(async (context) => {
|
|
4479
|
-
context.
|
|
4432
|
+
context.debug(`Initializing the processing options for the Powerlines project.`);
|
|
4480
4433
|
await this.callHook("configResolved", {
|
|
4481
4434
|
environment: context,
|
|
4482
4435
|
order: "pre"
|
|
@@ -4486,7 +4439,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
4486
4439
|
environment: context,
|
|
4487
4440
|
order: "normal"
|
|
4488
4441
|
});
|
|
4489
|
-
context.
|
|
4442
|
+
context.debug(`The configuration provided ${toArray.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 ? `:
|
|
4490
4443
|
${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.output}` : ""}`).join(" \n")}` : ""}.`);
|
|
4491
4444
|
await resolveTsconfig(context);
|
|
4492
4445
|
await installDependencies(context);
|
|
@@ -4494,7 +4447,7 @@ ${context.entry.map((entry) => `- ${entry.file}${entry.output ? ` -> ${entry.out
|
|
|
4494
4447
|
environment: context,
|
|
4495
4448
|
order: "post"
|
|
4496
4449
|
});
|
|
4497
|
-
context.
|
|
4450
|
+
context.trace(`Powerlines configuration has been resolved:
|
|
4498
4451
|
|
|
4499
4452
|
${console.formatLogMessage(context.config)}`);
|
|
4500
4453
|
if (!context.fs.existsSync(context.cachePath)) {
|
|
@@ -4512,11 +4465,11 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4512
4465
|
order: "normal"
|
|
4513
4466
|
});
|
|
4514
4467
|
if (context.config.output.dts !== false) {
|
|
4515
|
-
context.
|
|
4468
|
+
context.debug(`Preparing the TypeScript definitions for the Powerlines project.`);
|
|
4516
4469
|
if (context.fs.existsSync(context.dtsPath)) {
|
|
4517
4470
|
await context.fs.remove(context.dtsPath);
|
|
4518
4471
|
}
|
|
4519
|
-
context.
|
|
4472
|
+
context.debug("Transforming built-ins runtime modules files.");
|
|
4520
4473
|
const builtinFilePaths = await Promise.all((await context.getBuiltins()).map(async (file) => {
|
|
4521
4474
|
const result2 = await core.transformAsync(file.code.toString(), {
|
|
4522
4475
|
highlightCode: true,
|
|
@@ -4549,7 +4502,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4549
4502
|
context.warn(`File ID is missing for a built-in runtime file at ${file.path}.`);
|
|
4550
4503
|
file.id = replace.replacePath(replace.replacePath(file.path, context.workspaceConfig.workspaceRoot), context.builtinsPath);
|
|
4551
4504
|
}
|
|
4552
|
-
context.
|
|
4505
|
+
context.trace(`Writing transformed built-in runtime file ${file.id}.`);
|
|
4553
4506
|
await context.emitBuiltin(result2.code, file.id);
|
|
4554
4507
|
return file.path;
|
|
4555
4508
|
}));
|
|
@@ -4568,9 +4521,9 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4568
4521
|
[]
|
|
4569
4522
|
// [joinPaths(typescriptPath, "lib", "lib.esnext.full.d.ts")]
|
|
4570
4523
|
);
|
|
4571
|
-
context.
|
|
4572
|
-
let types
|
|
4573
|
-
context.
|
|
4524
|
+
context.debug("Parsing TypeScript configuration for the Powerlines project.");
|
|
4525
|
+
let types = await emitTypes(context, files);
|
|
4526
|
+
context.debug(`Generating TypeScript declaration file ${context.dtsPath}.`);
|
|
4574
4527
|
const directives = [];
|
|
4575
4528
|
const asNextParam = /* @__PURE__ */ chunkSHUYVCID_js.__name((previousResult) => isObject.isObject(previousResult) ? previousResult.code : previousResult, "asNextParam");
|
|
4576
4529
|
let result = await this.callHook("types", {
|
|
@@ -4579,15 +4532,15 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4579
4532
|
order: "pre",
|
|
4580
4533
|
result: "merge",
|
|
4581
4534
|
asNextParam
|
|
4582
|
-
}, types
|
|
4535
|
+
}, types);
|
|
4583
4536
|
if (result) {
|
|
4584
4537
|
if (isSetObject.isSetObject(result)) {
|
|
4585
|
-
types
|
|
4538
|
+
types = result.code;
|
|
4586
4539
|
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
4587
4540
|
directives.push(...result.directives);
|
|
4588
4541
|
}
|
|
4589
4542
|
} else if (isSetString.isSetString(result)) {
|
|
4590
|
-
types
|
|
4543
|
+
types = result;
|
|
4591
4544
|
}
|
|
4592
4545
|
}
|
|
4593
4546
|
result = await this.callHook("types", {
|
|
@@ -4596,15 +4549,15 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4596
4549
|
order: "normal",
|
|
4597
4550
|
result: "merge",
|
|
4598
4551
|
asNextParam
|
|
4599
|
-
}, types
|
|
4552
|
+
}, types);
|
|
4600
4553
|
if (result) {
|
|
4601
4554
|
if (isSetObject.isSetObject(result)) {
|
|
4602
|
-
types
|
|
4555
|
+
types = result.code;
|
|
4603
4556
|
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
4604
4557
|
directives.push(...result.directives);
|
|
4605
4558
|
}
|
|
4606
4559
|
} else if (isSetString.isSetString(result)) {
|
|
4607
|
-
types
|
|
4560
|
+
types = result;
|
|
4608
4561
|
}
|
|
4609
4562
|
}
|
|
4610
4563
|
result = await this.callHook("types", {
|
|
@@ -4613,18 +4566,18 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4613
4566
|
order: "post",
|
|
4614
4567
|
result: "merge",
|
|
4615
4568
|
asNextParam
|
|
4616
|
-
}, types
|
|
4569
|
+
}, types);
|
|
4617
4570
|
if (result) {
|
|
4618
4571
|
if (isSetObject.isSetObject(result)) {
|
|
4619
|
-
types
|
|
4572
|
+
types = result.code;
|
|
4620
4573
|
if (Array.isArray(result.directives) && result.directives.length > 0) {
|
|
4621
4574
|
directives.push(...result.directives);
|
|
4622
4575
|
}
|
|
4623
4576
|
} else if (isSetString.isSetString(result)) {
|
|
4624
|
-
types
|
|
4577
|
+
types = result;
|
|
4625
4578
|
}
|
|
4626
4579
|
}
|
|
4627
|
-
if (types
|
|
4580
|
+
if (types?.trim() || directives.length > 0) {
|
|
4628
4581
|
await context.fs.write(context.dtsPath, `${directives ? `${directives.map((directive) => `/// <reference types="${directive}" />`).join("\n")}
|
|
4629
4582
|
|
|
4630
4583
|
` : ""}${getFileHeader(context, {
|
|
@@ -4632,7 +4585,7 @@ ${console.formatLogMessage(context.config)}`);
|
|
|
4632
4585
|
prettierIgnore: false
|
|
4633
4586
|
})}
|
|
4634
4587
|
|
|
4635
|
-
${formatTypes(types
|
|
4588
|
+
${formatTypes(types)}
|
|
4636
4589
|
`);
|
|
4637
4590
|
} else {
|
|
4638
4591
|
const dtsRelativePath = getTsconfigDtsPath(context);
|
|
@@ -4647,7 +4600,7 @@ ${formatTypes(types$1)}
|
|
|
4647
4600
|
if (!context.tsconfig) {
|
|
4648
4601
|
throw new Error("Failed to parse the TypeScript configuration file.");
|
|
4649
4602
|
}
|
|
4650
|
-
this.context.
|
|
4603
|
+
this.context.debug("Formatting files generated during the prepare step.");
|
|
4651
4604
|
await Promise.all([
|
|
4652
4605
|
formatFolder(context, context.builtinsPath),
|
|
4653
4606
|
formatFolder(context, context.entryPath)
|
|
@@ -4659,7 +4612,7 @@ ${formatTypes(types$1)}
|
|
|
4659
4612
|
await chunkDQI2I5KK_js.writeMetaFile(context);
|
|
4660
4613
|
context.persistedMeta = context.meta;
|
|
4661
4614
|
});
|
|
4662
|
-
this.context.
|
|
4615
|
+
this.context.info("\u2714 Powerlines preparation has completed successfully");
|
|
4663
4616
|
}
|
|
4664
4617
|
/**
|
|
4665
4618
|
* Create a new Powerlines project
|
|
@@ -4671,17 +4624,17 @@ ${formatTypes(types$1)}
|
|
|
4671
4624
|
* @returns A promise that resolves when the project has been created
|
|
4672
4625
|
*/
|
|
4673
4626
|
async new(inlineConfig) {
|
|
4674
|
-
this.context.
|
|
4627
|
+
this.context.info("\u{1F195} Creating a new Powerlines project");
|
|
4675
4628
|
await this.prepare(inlineConfig);
|
|
4676
4629
|
await this.#executeEnvironments(async (context) => {
|
|
4677
|
-
context.
|
|
4630
|
+
context.debug("Initializing the processing options for the Powerlines project.");
|
|
4678
4631
|
await this.callHook("new", {
|
|
4679
4632
|
environment: context,
|
|
4680
4633
|
order: "pre"
|
|
4681
4634
|
});
|
|
4682
4635
|
const files = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/common/**/*.hbs"));
|
|
4683
4636
|
for (const file of files) {
|
|
4684
|
-
context.
|
|
4637
|
+
context.trace(`Adding template file to project: ${file}`);
|
|
4685
4638
|
const template = Handlebars__default.default.compile(file);
|
|
4686
4639
|
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4687
4640
|
}
|
|
@@ -4692,14 +4645,14 @@ ${formatTypes(types$1)}
|
|
|
4692
4645
|
if (context.config.projectType === "application") {
|
|
4693
4646
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/application/**/*.hbs"));
|
|
4694
4647
|
for (const file of files2) {
|
|
4695
|
-
context.
|
|
4648
|
+
context.trace(`Adding application template file: ${file}`);
|
|
4696
4649
|
const template = Handlebars__default.default.compile(file);
|
|
4697
4650
|
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4698
4651
|
}
|
|
4699
4652
|
} else {
|
|
4700
4653
|
const files2 = await listFiles.listFiles(joinPaths.joinPaths(context.powerlinesPath, "files/library/**/*.hbs"));
|
|
4701
4654
|
for (const file of files2) {
|
|
4702
|
-
context.
|
|
4655
|
+
context.trace(`Adding library template file: ${file}`);
|
|
4703
4656
|
const template = Handlebars__default.default.compile(file);
|
|
4704
4657
|
await context.fs.write(joinPaths.joinPaths(context.config.projectRoot, file.replace(".hbs", "")), template(context));
|
|
4705
4658
|
}
|
|
@@ -4709,7 +4662,7 @@ ${formatTypes(types$1)}
|
|
|
4709
4662
|
order: "post"
|
|
4710
4663
|
});
|
|
4711
4664
|
});
|
|
4712
|
-
this.context.
|
|
4665
|
+
this.context.debug("\u2714 Powerlines new command completed successfully");
|
|
4713
4666
|
}
|
|
4714
4667
|
/**
|
|
4715
4668
|
* Clean any previously prepared artifacts
|
|
@@ -4723,10 +4676,10 @@ ${formatTypes(types$1)}
|
|
|
4723
4676
|
async clean(inlineConfig = {
|
|
4724
4677
|
command: "clean"
|
|
4725
4678
|
}) {
|
|
4726
|
-
this.context.
|
|
4679
|
+
this.context.info("\u{1F9F9} Cleaning the previous Powerlines artifacts");
|
|
4727
4680
|
await this.prepare(inlineConfig);
|
|
4728
4681
|
await this.#executeEnvironments(async (context) => {
|
|
4729
|
-
|
|
4682
|
+
context.debug("Cleaning the project's dist and artifacts directories.");
|
|
4730
4683
|
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.output.buildPath));
|
|
4731
4684
|
await context.fs.remove(joinPaths.joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, context.config.output.artifactsPath));
|
|
4732
4685
|
await this.callHook("clean", {
|
|
@@ -4734,7 +4687,7 @@ ${formatTypes(types$1)}
|
|
|
4734
4687
|
sequential: false
|
|
4735
4688
|
});
|
|
4736
4689
|
});
|
|
4737
|
-
this.context.
|
|
4690
|
+
this.context.debug("\u2714 Powerlines cleaning completed successfully");
|
|
4738
4691
|
}
|
|
4739
4692
|
/**
|
|
4740
4693
|
* Lint the project
|
|
@@ -4745,7 +4698,7 @@ ${formatTypes(types$1)}
|
|
|
4745
4698
|
async lint(inlineConfig = {
|
|
4746
4699
|
command: "lint"
|
|
4747
4700
|
}) {
|
|
4748
|
-
this.context.
|
|
4701
|
+
this.context.info("\u{1F4CB} Linting the Powerlines project");
|
|
4749
4702
|
await this.prepare(inlineConfig);
|
|
4750
4703
|
await this.#executeEnvironments(async (context) => {
|
|
4751
4704
|
if (context.config.lint !== false) {
|
|
@@ -4755,7 +4708,7 @@ ${formatTypes(types$1)}
|
|
|
4755
4708
|
});
|
|
4756
4709
|
}
|
|
4757
4710
|
});
|
|
4758
|
-
this.context.
|
|
4711
|
+
this.context.debug("\u2714 Powerlines linting completed successfully");
|
|
4759
4712
|
}
|
|
4760
4713
|
/**
|
|
4761
4714
|
* Build the project
|
|
@@ -4769,7 +4722,7 @@ ${formatTypes(types$1)}
|
|
|
4769
4722
|
async build(inlineConfig = {
|
|
4770
4723
|
command: "build"
|
|
4771
4724
|
}) {
|
|
4772
|
-
this.context.
|
|
4725
|
+
this.context.info("\u{1F4E6} Building the Powerlines project");
|
|
4773
4726
|
await this.prepare(inlineConfig);
|
|
4774
4727
|
if (this.context.config.singleBuild) {
|
|
4775
4728
|
await this.#handleBuild(await this.#context.toEnvironment());
|
|
@@ -4778,7 +4731,7 @@ ${formatTypes(types$1)}
|
|
|
4778
4731
|
await this.#handleBuild(context);
|
|
4779
4732
|
});
|
|
4780
4733
|
}
|
|
4781
|
-
this.context.
|
|
4734
|
+
this.context.debug("\u2714 Powerlines build completed successfully");
|
|
4782
4735
|
}
|
|
4783
4736
|
/**
|
|
4784
4737
|
* Prepare the documentation for the project
|
|
@@ -4789,10 +4742,10 @@ ${formatTypes(types$1)}
|
|
|
4789
4742
|
async docs(inlineConfig = {
|
|
4790
4743
|
command: "docs"
|
|
4791
4744
|
}) {
|
|
4792
|
-
this.context.
|
|
4745
|
+
this.context.info("\u{1F4D3} Generating documentation for the Powerlines project");
|
|
4793
4746
|
await this.prepare(inlineConfig);
|
|
4794
4747
|
await this.#executeEnvironments(async (context) => {
|
|
4795
|
-
context.
|
|
4748
|
+
context.debug("Writing documentation for the Powerlines project artifacts.");
|
|
4796
4749
|
await this.prepare(inlineConfig);
|
|
4797
4750
|
await this.#executeEnvironments(async (context2) => {
|
|
4798
4751
|
await this.callHook("docs", {
|
|
@@ -4800,7 +4753,7 @@ ${formatTypes(types$1)}
|
|
|
4800
4753
|
});
|
|
4801
4754
|
});
|
|
4802
4755
|
});
|
|
4803
|
-
this
|
|
4756
|
+
this.context.debug("\u2714 Powerlines documentation generation completed successfully");
|
|
4804
4757
|
}
|
|
4805
4758
|
/**
|
|
4806
4759
|
* Deploy the project source code
|
|
@@ -4813,14 +4766,14 @@ ${formatTypes(types$1)}
|
|
|
4813
4766
|
async deploy(inlineConfig = {
|
|
4814
4767
|
command: "deploy"
|
|
4815
4768
|
}) {
|
|
4816
|
-
this.context.
|
|
4769
|
+
this.context.info("\u{1F680} Deploying the Powerlines project");
|
|
4817
4770
|
await this.prepare(inlineConfig);
|
|
4818
4771
|
await this.#executeEnvironments(async (context) => {
|
|
4819
4772
|
await this.callHook("deploy", {
|
|
4820
4773
|
environment: context
|
|
4821
4774
|
});
|
|
4822
4775
|
});
|
|
4823
|
-
this.context.
|
|
4776
|
+
this.context.debug("\u2714 Powerlines deploy completed successfully");
|
|
4824
4777
|
}
|
|
4825
4778
|
/**
|
|
4826
4779
|
* Finalization process
|
|
@@ -4831,14 +4784,14 @@ ${formatTypes(types$1)}
|
|
|
4831
4784
|
* @returns A promise that resolves when the finalization process has completed
|
|
4832
4785
|
*/
|
|
4833
4786
|
async finalize() {
|
|
4834
|
-
this.context.
|
|
4787
|
+
this.context.info("\u{1F3C1} Powerlines finalization processes started");
|
|
4835
4788
|
await this.#executeEnvironments(async (context) => {
|
|
4836
4789
|
await this.callHook("finalize", {
|
|
4837
4790
|
environment: context
|
|
4838
4791
|
});
|
|
4839
4792
|
await context.fs.dispose();
|
|
4840
4793
|
});
|
|
4841
|
-
this.context.
|
|
4794
|
+
this.context.debug("\u2714 Powerlines finalization completed successfully");
|
|
4842
4795
|
}
|
|
4843
4796
|
/**
|
|
4844
4797
|
* Invokes the configured plugin hooks
|
|
@@ -4879,12 +4832,12 @@ ${formatTypes(types$1)}
|
|
|
4879
4832
|
const sourcePath = append.appendPath(context.config.output.buildPath, context.workspaceConfig.workspaceRoot);
|
|
4880
4833
|
const destinationPath = joinPaths.joinPaths(append.appendPath(context.config.output.outputPath, context.workspaceConfig.workspaceRoot), "dist");
|
|
4881
4834
|
if (context.fs.existsSync(sourcePath) && sourcePath !== destinationPath) {
|
|
4882
|
-
context.
|
|
4835
|
+
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}).`);
|
|
4883
4836
|
await context.fs.copy(sourcePath, destinationPath);
|
|
4884
4837
|
}
|
|
4885
4838
|
}
|
|
4886
4839
|
await Promise.all(context.config.output.assets.map(async (asset) => {
|
|
4887
|
-
context.
|
|
4840
|
+
context.trace(`Copying asset(s): ${chalk5__default.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : joinPaths.joinPaths(replace.replacePath(asset.input, context.workspaceConfig.workspaceRoot), asset.glob))} -> ${chalk5__default.default.greenBright(joinPaths.joinPaths(replace.replacePath(asset.output, context.workspaceConfig.workspaceRoot), asset.glob))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk5__default.default.yellowBright(i)).join(", ")})` : ""}`);
|
|
4888
4841
|
await context.fs.copy(asset, asset.output);
|
|
4889
4842
|
}));
|
|
4890
4843
|
await this.callHook("build", {
|
|
@@ -4899,12 +4852,12 @@ ${formatTypes(types$1)}
|
|
|
4899
4852
|
*/
|
|
4900
4853
|
async #getEnvironments() {
|
|
4901
4854
|
if (!this.context.config.environments || Object.keys(this.context.config.environments).length <= 1) {
|
|
4902
|
-
this.context.
|
|
4855
|
+
this.context.debug("No environments are configured for this Powerlines project. Using the default environment.");
|
|
4903
4856
|
return [
|
|
4904
4857
|
await this.context.getEnvironment()
|
|
4905
4858
|
];
|
|
4906
4859
|
}
|
|
4907
|
-
this.context.
|
|
4860
|
+
this.context.debug(`Found ${Object.keys(this.context.config.environments).length} configured environment(s) for this Powerlines project.`);
|
|
4908
4861
|
return (await Promise.all(Object.entries(this.context.config.environments).map(async ([name, config]) => {
|
|
4909
4862
|
const environment = await this.context.getEnvironmentSafe(name);
|
|
4910
4863
|
if (!environment) {
|
|
@@ -4940,7 +4893,7 @@ ${formatTypes(types$1)}
|
|
|
4940
4893
|
return;
|
|
4941
4894
|
}
|
|
4942
4895
|
for (const plugin of result) {
|
|
4943
|
-
this.context.
|
|
4896
|
+
this.context.debug(`Successfully initialized the ${chalk5__default.default.bold.cyanBright(plugin.name)} plugin`);
|
|
4944
4897
|
await this.context.addPlugin(plugin);
|
|
4945
4898
|
}
|
|
4946
4899
|
}
|
|
@@ -5027,10 +4980,10 @@ Please ensure the value is one of the following:
|
|
|
5027
4980
|
const result = [];
|
|
5028
4981
|
for (const plugin of plugins) {
|
|
5029
4982
|
if (checkDedupe(plugin, this.context.plugins)) {
|
|
5030
|
-
this.context.
|
|
4983
|
+
this.context.trace(`Duplicate ${chalk5__default.default.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
5031
4984
|
} else {
|
|
5032
4985
|
result.push(plugin);
|
|
5033
|
-
this.context.
|
|
4986
|
+
this.context.trace(`Initializing the ${chalk5__default.default.bold.cyanBright(plugin.name)} plugin...`);
|
|
5034
4987
|
}
|
|
5035
4988
|
}
|
|
5036
4989
|
return result;
|
|
@@ -5047,12 +5000,12 @@ Please ensure the value is one of the following:
|
|
|
5047
5000
|
]
|
|
5048
5001
|
});
|
|
5049
5002
|
if (!isInstalled && this.context.config.skipInstalls !== true) {
|
|
5050
|
-
this.#context.
|
|
5003
|
+
this.#context.warn(`The plugin package "${pluginPath}" is not installed. It will be installed automatically.`);
|
|
5051
5004
|
const result = await install.install(pluginPath, {
|
|
5052
5005
|
cwd: this.context.config.projectRoot
|
|
5053
5006
|
});
|
|
5054
5007
|
if (isNumber.isNumber(result.exitCode) && result.exitCode > 0) {
|
|
5055
|
-
this.#context.
|
|
5008
|
+
this.#context.error(result.stderr);
|
|
5056
5009
|
throw new Error(`An error occurred while installing the build plugin package "${pluginPath}" `);
|
|
5057
5010
|
}
|
|
5058
5011
|
}
|