@powerlines/engine 0.44.12 → 0.45.1
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/_internal/worker.cjs +143 -106
- package/dist/_internal/worker.d.cts +16 -8
- package/dist/_internal/worker.d.cts.map +1 -1
- package/dist/_internal/worker.d.mts +16 -8
- package/dist/_internal/worker.d.mts.map +1 -1
- package/dist/_internal/worker.mjs +144 -107
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +60 -46
- package/dist/api.d.cts +18 -13
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +18 -13
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +60 -46
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-C6yzgs6K.mjs → base-context-BSAC5sO9.mjs} +21 -15
- package/dist/base-context-BSAC5sO9.mjs.map +1 -0
- package/dist/{base-context-trNQZNsX.cjs → base-context-Byizvf4F.cjs} +20 -14
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +13 -8
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +13 -8
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-D1_U6xVC.cjs → engine-context-CI_0NWIk.cjs} +5 -3
- package/dist/{engine-context-C-11i43N.mjs → engine-context-_RMFwG4J.mjs} +6 -4
- package/dist/engine-context-_RMFwG4J.mjs.map +1 -0
- package/dist/{execution-context-D9Enw3J5.mjs → execution-context-O6eXdsCn.mjs} +65 -50
- package/dist/execution-context-O6eXdsCn.mjs.map +1 -0
- package/dist/{execution-context-C-M-Mxse.cjs → execution-context-SXtPe9Ae.cjs} +63 -48
- package/dist/index.cjs +30 -20
- package/dist/index.d.cts +9 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +9 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +30 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/base-context-C6yzgs6K.mjs.map +0 -1
- package/dist/engine-context-C-11i43N.mjs.map +0 -1
- package/dist/execution-context-D9Enw3J5.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
2
|
-
const require_base_context = require('./base-context-
|
|
2
|
+
const require_base_context = require('./base-context-Byizvf4F.cjs');
|
|
3
3
|
const require_fs = require('./fs-XogSgMqT.cjs');
|
|
4
4
|
const require_virtual = require('./virtual-Ct3ZqPeN.cjs');
|
|
5
5
|
const require_tsconfig = require('./tsconfig-QMSxSwBD.cjs');
|
|
@@ -25,6 +25,7 @@ defu = require_chunk.__toESM(defu, 1);
|
|
|
25
25
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
26
26
|
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
27
27
|
let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
|
|
28
|
+
let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
|
|
28
29
|
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
29
30
|
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
30
31
|
let _stryke_helpers_omit = require("@stryke/helpers/omit");
|
|
@@ -1306,9 +1307,9 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1306
1307
|
* @param options - The options for resolving the context.
|
|
1307
1308
|
* @returns A promise that resolves to the new context.
|
|
1308
1309
|
*/
|
|
1309
|
-
static async
|
|
1310
|
+
static async init(options, initialConfig) {
|
|
1310
1311
|
const context = new PowerlinesContext(options);
|
|
1311
|
-
await context.init(options);
|
|
1312
|
+
await context.init(options, initialConfig);
|
|
1312
1313
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
1313
1314
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
1314
1315
|
context.powerlinesPath = powerlinesPath;
|
|
@@ -1611,7 +1612,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1611
1612
|
* @returns A promise that resolves to the cloned context.
|
|
1612
1613
|
*/
|
|
1613
1614
|
async clone() {
|
|
1614
|
-
const clone = await PowerlinesContext.
|
|
1615
|
+
const clone = await PowerlinesContext.init(this.options, this.initialConfig);
|
|
1615
1616
|
return this.copyTo(clone);
|
|
1616
1617
|
}
|
|
1617
1618
|
/**
|
|
@@ -1965,8 +1966,9 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1965
1966
|
cwd: this.options.cwd,
|
|
1966
1967
|
inlineConfig: this.config.inlineConfig ?? {},
|
|
1967
1968
|
userConfig: this.config.userConfig ?? {},
|
|
1969
|
+
initialConfig: this.config.initialConfig ?? {},
|
|
1968
1970
|
pluginConfig: this.config.pluginConfig ?? {}
|
|
1969
|
-
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
1971
|
+
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.initialConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
1970
1972
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
1971
1973
|
version: this.packageJson?.version,
|
|
1972
1974
|
description: this.packageJson?.description
|
|
@@ -1991,7 +1993,8 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
1991
1993
|
copyTo(context) {
|
|
1992
1994
|
for (const [key, value] of Object.entries(this)) if (!SKIP_CLONING_PROPS.includes(key)) if ((0, _stryke_type_checks_is_object.isObject)(value) || Array.isArray(value)) context[key] = (0, _stryke_helpers_deep_clone.deepClone)(value);
|
|
1993
1995
|
else context[key] = value;
|
|
1994
|
-
context.
|
|
1996
|
+
context.initialConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.initialConfig);
|
|
1997
|
+
context.initialOptions = (0, _stryke_helpers_deep_clone.deepClone)(this.initialOptions);
|
|
1995
1998
|
context.options = (0, _stryke_helpers_deep_clone.deepClone)(this.options);
|
|
1996
1999
|
context.dependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.dependencies);
|
|
1997
2000
|
context.devDependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.devDependencies);
|
|
@@ -2012,8 +2015,8 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2012
2015
|
*
|
|
2013
2016
|
* @param options - The configuration options to initialize the context with
|
|
2014
2017
|
*/
|
|
2015
|
-
async init(options) {
|
|
2016
|
-
await super.init(options);
|
|
2018
|
+
async init(options, initialConfig) {
|
|
2019
|
+
await super.init(options, initialConfig ?? {});
|
|
2017
2020
|
this.options.executionId = options.executionId ?? this.options.executionId;
|
|
2018
2021
|
this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
|
|
2019
2022
|
const projectJsonPath = (0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root, "project.json");
|
|
@@ -2026,8 +2029,14 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2026
2029
|
this.#checksum = await this.generateChecksum((0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root));
|
|
2027
2030
|
const userConfig = this.configFile.config ? Array.isArray(this.configFile.config) && this.configFile.config.length > this.options.executionIndex ? this.configFile.config[this.options.executionIndex] : this.configFile.config : {};
|
|
2028
2031
|
this.resolvedConfig = {
|
|
2029
|
-
|
|
2032
|
+
cwd: this.options.cwd,
|
|
2033
|
+
root: this.options.root,
|
|
2034
|
+
...this.initialOptions,
|
|
2035
|
+
...initialConfig,
|
|
2030
2036
|
...userConfig,
|
|
2037
|
+
inlineConfig: {},
|
|
2038
|
+
pluginConfig: {},
|
|
2039
|
+
initialConfig,
|
|
2031
2040
|
userConfig
|
|
2032
2041
|
};
|
|
2033
2042
|
}
|
|
@@ -2050,28 +2059,33 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2050
2059
|
] },
|
|
2051
2060
|
dts: true
|
|
2052
2061
|
});
|
|
2053
|
-
logger.trace(`Pre-setup Powerlines configuration object: \n${
|
|
2054
|
-
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2062
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
|
|
2063
|
+
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2064
|
+
"inlineConfig",
|
|
2065
|
+
"userConfig",
|
|
2066
|
+
"initialConfig",
|
|
2067
|
+
"pluginConfig",
|
|
2068
|
+
"plugins"
|
|
2069
|
+
]),
|
|
2070
|
+
inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2071
|
+
userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : void 0,
|
|
2072
|
+
initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2073
|
+
pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2074
|
+
})}`);
|
|
2075
|
+
if (!this.initialOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.initialConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
2060
2076
|
this.options.mode = "production";
|
|
2061
2077
|
this.config.mode = "production";
|
|
2062
2078
|
}
|
|
2063
|
-
if (!this.
|
|
2079
|
+
if (!this.initialOptions.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.initialConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
2064
2080
|
this.options.framework = "powerlines";
|
|
2065
2081
|
this.config.framework = "powerlines";
|
|
2066
2082
|
}
|
|
2067
|
-
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2068
|
-
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2069
|
-
this.
|
|
2083
|
+
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.initialConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2084
|
+
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.initialConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2085
|
+
this.config.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.initialConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2070
2086
|
this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
|
|
2071
2087
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
2072
2088
|
this.config.title ??= (0, _stryke_string_format_title_case.titleCase)(this.config.name);
|
|
2073
|
-
if (this.config.userConfig.resolve?.external) this.config.userConfig.resolve.external = (0, _stryke_helpers_get_unique.getUnique)(this.config.userConfig.resolve.external);
|
|
2074
|
-
if (this.config.userConfig.resolve?.noExternal) this.config.userConfig.resolve.noExternal = (0, _stryke_helpers_get_unique.getUnique)(this.config.userConfig.resolve.noExternal);
|
|
2075
2089
|
if (this.config.resolve.external) this.config.resolve.external = (0, _stryke_helpers_get_unique.getUnique)(this.config.resolve.external);
|
|
2076
2090
|
if (this.config.resolve.noExternal) this.config.resolve.noExternal = (0, _stryke_helpers_get_unique.getUnique)(this.config.resolve.noExternal);
|
|
2077
2091
|
this.config.plugins = (this.config.plugins ?? []).flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin)).filter(Boolean).reduce((ret, plugin) => {
|
|
@@ -2079,10 +2093,10 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2079
2093
|
ret.push(plugin);
|
|
2080
2094
|
return ret;
|
|
2081
2095
|
}, []);
|
|
2082
|
-
if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2096
|
+
if (!this.config.userConfig?.logLevel && !this.config.initialConfig?.logLevel && !this.config.pluginConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2083
2097
|
else if (this.config.mode === "test") this.config.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
|
|
2084
2098
|
else this.config.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
2085
|
-
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = require_tsconfig.getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
2099
|
+
if (!this.config.userConfig?.tsconfig && !this.config.initialConfig?.tsconfig && !this.config.pluginConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = require_tsconfig.getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
2086
2100
|
else if (this.config.tsconfig) this.config.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.tsconfig), this.config.cwd);
|
|
2087
2101
|
this.config.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
2088
2102
|
if (this.config.output.path) this.config.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.path), this.config.cwd);
|
|
@@ -2092,7 +2106,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2092
2106
|
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
2093
2107
|
else this.config.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.copy.path || (0, _stryke_path_join.joinPaths)("dist", this.config.root)), this.config.cwd);
|
|
2094
2108
|
}
|
|
2095
|
-
if (this.config.output.types !== false) this.config.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.userConfig?.output?.types || this.config.inlineConfig?.output?.types || this.config.pluginConfig?.output?.types || (0, _stryke_path_join.joinPaths)(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
2109
|
+
if (this.config.output.types !== false) this.config.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.userConfig?.output?.types || this.config.inlineConfig?.output?.types || this.config.initialConfig?.output?.types || this.config.pluginConfig?.output?.types || (0, _stryke_path_join.joinPaths)(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
2096
2110
|
if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(this.config.output.copy.assets.map((asset) => {
|
|
2097
2111
|
return {
|
|
2098
2112
|
glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
|
|
@@ -2101,11 +2115,11 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2101
2115
|
ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
|
|
2102
2116
|
};
|
|
2103
2117
|
}), (a) => `${a.input}-${a.glob}-${a.output}`);
|
|
2104
|
-
if (!this.config.userConfig?.output?.sourceMap && !this.config.inlineConfig?.output?.sourceMap) if (this.config.mode === "development") this.config.output.sourceMap = true;
|
|
2118
|
+
if (!this.config.userConfig?.output?.sourceMap && !this.config.initialConfig?.output?.sourceMap && !this.config.inlineConfig?.output?.sourceMap && !this.config.pluginConfig?.output?.sourceMap) if (this.config.mode === "development") this.config.output.sourceMap = true;
|
|
2105
2119
|
else this.config.output.sourceMap = false;
|
|
2106
|
-
if (!this.config.userConfig?.output?.minify && !this.config.inlineConfig?.output?.minify) if (this.config.mode === "production") this.config.output.minify = true;
|
|
2120
|
+
if (!this.config.userConfig?.output?.minify && !this.config.initialConfig?.output?.minify && !this.config.inlineConfig?.output?.minify && !this.config.pluginConfig?.output?.minify) if (this.config.mode === "production") this.config.output.minify = true;
|
|
2107
2121
|
else this.config.output.minify = false;
|
|
2108
|
-
if (!this.config.userConfig?.output?.artifactsPath && !this.config.inlineConfig?.output?.artifactsPath && !this.config.pluginConfig?.output?.artifactsPath) this.config.output.artifactsPath = `.${this.config.framework || "powerlines"}`;
|
|
2122
|
+
if (!this.config.userConfig?.output?.artifactsPath && !this.config.initialConfig?.output?.artifactsPath && !this.config.inlineConfig?.output?.artifactsPath && !this.config.pluginConfig?.output?.artifactsPath) this.config.output.artifactsPath = `.${this.config.framework || "powerlines"}`;
|
|
2109
2123
|
if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
|
|
2110
2124
|
...asset,
|
|
2111
2125
|
glob: (0, _powerlines_core_plugin_utils.replacePathTokens)(this, asset.glob),
|
|
@@ -2115,24 +2129,24 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2115
2129
|
}));
|
|
2116
2130
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.output?.storage) && this.config.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
|
|
2117
2131
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2118
|
-
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.
|
|
2119
|
-
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2132
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.initialConfig) && (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig)) logger.debug(`Resolved Powerlines configuration object: \n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
|
|
2133
|
+
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2134
|
+
"inlineConfig",
|
|
2135
|
+
"userConfig",
|
|
2136
|
+
"initialConfig",
|
|
2137
|
+
"pluginConfig",
|
|
2138
|
+
"plugins"
|
|
2139
|
+
]),
|
|
2140
|
+
inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2141
|
+
userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : void 0,
|
|
2142
|
+
initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2143
|
+
pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2144
|
+
})}`);
|
|
2124
2145
|
}
|
|
2125
2146
|
};
|
|
2126
2147
|
|
|
2127
2148
|
//#endregion
|
|
2128
2149
|
//#region src/_internal/helpers/hooks.ts
|
|
2129
|
-
const mergeResultObjects = (0, defu.createDefu)((obj, key, value) => {
|
|
2130
|
-
if ((0, _stryke_type_checks_is_string.isString)(obj[key]) && (0, _stryke_type_checks_is_string.isString)(value)) {
|
|
2131
|
-
obj[key] = `${obj[key] || ""}\n${value || ""}`.trim();
|
|
2132
|
-
return true;
|
|
2133
|
-
}
|
|
2134
|
-
return false;
|
|
2135
|
-
});
|
|
2136
2150
|
/**
|
|
2137
2151
|
* Merges the current hook result with the previous results based on their types.
|
|
2138
2152
|
*
|
|
@@ -2143,7 +2157,7 @@ const mergeResultObjects = (0, defu.createDefu)((obj, key, value) => {
|
|
|
2143
2157
|
function mergeResults(currentResult, previousResults) {
|
|
2144
2158
|
if (!previousResults || previousResults.length === 0) return [currentResult];
|
|
2145
2159
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(currentResult)) previousResults = [`${(0, _stryke_type_checks_is_set_string.isSetString)(previousResults[0]) ? previousResults[0] || "" : ""}\n${(0, _stryke_type_checks_is_set_string.isSetString)(previousResults[0]) ? currentResult.replace(previousResults[0], "") : currentResult}`.trim()];
|
|
2146
|
-
else if ((0, _stryke_type_checks_is_object.isObject)(currentResult)) previousResults = [
|
|
2160
|
+
else if ((0, _stryke_type_checks_is_object.isObject)(currentResult)) previousResults = previousResults.length > 0 ? [(0, defu.defu)(currentResult, previousResults[0])] : [currentResult];
|
|
2147
2161
|
return previousResults;
|
|
2148
2162
|
}
|
|
2149
2163
|
/**
|
|
@@ -2521,9 +2535,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2521
2535
|
* @param options - The options for resolving the context.
|
|
2522
2536
|
* @returns A promise that resolves to the new context.
|
|
2523
2537
|
*/
|
|
2524
|
-
static async
|
|
2538
|
+
static async init(options, initialConfig) {
|
|
2525
2539
|
const context = new PowerlinesExecutionContext(options);
|
|
2526
|
-
await context.init(options);
|
|
2540
|
+
await context.init(options, initialConfig);
|
|
2527
2541
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
2528
2542
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
2529
2543
|
context.powerlinesPath = powerlinesPath;
|
|
@@ -2535,10 +2549,10 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2535
2549
|
* @param options - The options for resolving the context.
|
|
2536
2550
|
* @returns A promise that resolves to the new context.
|
|
2537
2551
|
*/
|
|
2538
|
-
static async
|
|
2552
|
+
static async inline(options, initialConfig, inlineConfig) {
|
|
2539
2553
|
const context = new PowerlinesExecutionContext(options);
|
|
2540
|
-
await context.init(options);
|
|
2541
|
-
context.config.inlineConfig =
|
|
2554
|
+
await context.init(options, initialConfig);
|
|
2555
|
+
context.config.inlineConfig = inlineConfig;
|
|
2542
2556
|
if (context.config.inlineConfig.command === "new") {
|
|
2543
2557
|
const workspacePackageJsonPath = (0, _stryke_path_join.joinPaths)(context.config.cwd, "package.json");
|
|
2544
2558
|
if (!(0, _stryke_fs_exists.existsSync)(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
|
|
@@ -2632,8 +2646,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2632
2646
|
* @returns A promise that resolves to the cloned context.
|
|
2633
2647
|
*/
|
|
2634
2648
|
async clone() {
|
|
2635
|
-
const clone = await PowerlinesExecutionContext.
|
|
2649
|
+
const clone = await PowerlinesExecutionContext.init(this.options, this.initialConfig);
|
|
2636
2650
|
clone.config.userConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.userConfig);
|
|
2651
|
+
clone.config.initialConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.initialConfig);
|
|
2637
2652
|
clone.config.inlineConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.inlineConfig);
|
|
2638
2653
|
clone.config.pluginConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.pluginConfig);
|
|
2639
2654
|
await clone.setup();
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
-
const require_engine_context = require('./engine-context-
|
|
3
|
+
const require_engine_context = require('./engine-context-CI_0NWIk.cjs');
|
|
4
4
|
let _powerlines_core_constants = require("@powerlines/core/constants");
|
|
5
5
|
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
6
6
|
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
@@ -410,10 +410,11 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
410
410
|
* Create a new Powerlines Engine instance
|
|
411
411
|
*
|
|
412
412
|
* @param options - The options to initialize the context with
|
|
413
|
+
* @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
|
|
413
414
|
* @returns A new instance of the Powerlines Engine
|
|
414
415
|
*/
|
|
415
|
-
static async
|
|
416
|
-
const api = new PowerlinesEngine(await require_engine_context.PowerlinesEngineContext.
|
|
416
|
+
static async init(options, initialConfig = {}) {
|
|
417
|
+
const api = new PowerlinesEngine(await require_engine_context.PowerlinesEngineContext.init(options, initialConfig));
|
|
417
418
|
const packagePath = await (0, _stryke_fs_resolve.resolvePackage)("@powerlines/engine");
|
|
418
419
|
if (!packagePath) throw new Error("Could not resolve `@powerlines/engine` package location.");
|
|
419
420
|
api.#worker = new Worker((0, _stryke_path_join.joinPaths)(packagePath, "./_internal/worker.mjs"), {
|
|
@@ -431,14 +432,6 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
431
432
|
return this.#context;
|
|
432
433
|
}
|
|
433
434
|
/**
|
|
434
|
-
* Create a new Powerlines Engine instance
|
|
435
|
-
*
|
|
436
|
-
* @param context - The Powerlines context
|
|
437
|
-
*/
|
|
438
|
-
constructor(context) {
|
|
439
|
-
this.#context = context;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
435
|
* Generate the Powerlines typescript declaration file
|
|
443
436
|
*
|
|
444
437
|
* @remarks
|
|
@@ -453,7 +446,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
453
446
|
inlineConfig.command ??= "types";
|
|
454
447
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
|
|
455
448
|
options: execution.options,
|
|
456
|
-
|
|
449
|
+
initialConfig: this.#context.initialConfig,
|
|
450
|
+
inlineConfig
|
|
457
451
|
})));
|
|
458
452
|
this.context.debug("✔ Powerlines types generation has completed successfully");
|
|
459
453
|
timer();
|
|
@@ -473,7 +467,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
473
467
|
inlineConfig.command ??= "prepare";
|
|
474
468
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
|
|
475
469
|
options: execution.options,
|
|
476
|
-
|
|
470
|
+
initialConfig: this.#context.initialConfig,
|
|
471
|
+
inlineConfig
|
|
477
472
|
})));
|
|
478
473
|
this.context.debug("✔ Powerlines preparation has completed successfully");
|
|
479
474
|
timer();
|
|
@@ -493,7 +488,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
493
488
|
inlineConfig.command ??= "new";
|
|
494
489
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
|
|
495
490
|
options: execution.options,
|
|
496
|
-
|
|
491
|
+
initialConfig: this.#context.initialConfig,
|
|
492
|
+
inlineConfig
|
|
497
493
|
})));
|
|
498
494
|
this.context.debug("✔ Powerlines new command completed successfully");
|
|
499
495
|
timer();
|
|
@@ -513,7 +509,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
513
509
|
inlineConfig.command ??= "clean";
|
|
514
510
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
|
|
515
511
|
options: execution.options,
|
|
516
|
-
|
|
512
|
+
initialConfig: this.#context.initialConfig,
|
|
513
|
+
inlineConfig
|
|
517
514
|
})));
|
|
518
515
|
this.context.debug("✔ Powerlines cleaning completed successfully");
|
|
519
516
|
timer();
|
|
@@ -530,7 +527,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
530
527
|
inlineConfig.command ??= "lint";
|
|
531
528
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
|
|
532
529
|
options: execution.options,
|
|
533
|
-
|
|
530
|
+
initialConfig: this.#context.initialConfig,
|
|
531
|
+
inlineConfig
|
|
534
532
|
})));
|
|
535
533
|
this.context.debug("✔ Powerlines linting completed successfully");
|
|
536
534
|
timer();
|
|
@@ -550,7 +548,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
550
548
|
inlineConfig.command ??= "test";
|
|
551
549
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
|
|
552
550
|
options: execution.options,
|
|
553
|
-
|
|
551
|
+
initialConfig: this.#context.initialConfig,
|
|
552
|
+
inlineConfig
|
|
554
553
|
})));
|
|
555
554
|
this.context.debug("✔ Powerlines testing completed successfully");
|
|
556
555
|
timer();
|
|
@@ -569,7 +568,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
569
568
|
this.context.info("📦 Building the Powerlines project");
|
|
570
569
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
|
|
571
570
|
options: execution.options,
|
|
572
|
-
|
|
571
|
+
initialConfig: this.#context.initialConfig,
|
|
572
|
+
inlineConfig
|
|
573
573
|
})));
|
|
574
574
|
this.context.debug("✔ Powerlines build completed successfully");
|
|
575
575
|
timer();
|
|
@@ -586,7 +586,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
586
586
|
inlineConfig.command ??= "docs";
|
|
587
587
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
|
|
588
588
|
options: execution.options,
|
|
589
|
-
|
|
589
|
+
initialConfig: this.#context.initialConfig,
|
|
590
|
+
inlineConfig
|
|
590
591
|
})));
|
|
591
592
|
this.context.debug("✔ Powerlines documentation generation completed successfully");
|
|
592
593
|
timer();
|
|
@@ -605,7 +606,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
605
606
|
inlineConfig.command ??= "deploy";
|
|
606
607
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
|
|
607
608
|
options: execution.options,
|
|
608
|
-
|
|
609
|
+
initialConfig: this.#context.initialConfig,
|
|
610
|
+
inlineConfig
|
|
609
611
|
})));
|
|
610
612
|
this.context.debug("✔ Powerlines deploy completed successfully");
|
|
611
613
|
timer();
|
|
@@ -632,6 +634,14 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
632
634
|
return this.finalize();
|
|
633
635
|
}
|
|
634
636
|
/**
|
|
637
|
+
* Create a new Powerlines Engine instance
|
|
638
|
+
*
|
|
639
|
+
* @param context - The Powerlines context
|
|
640
|
+
*/
|
|
641
|
+
constructor(context) {
|
|
642
|
+
this.#context = context;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
635
645
|
* Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
|
|
636
646
|
*
|
|
637
647
|
* @param message - The IPC message received from a worker process
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
1
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, InitialConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
2
2
|
import { PartialKeys } from "@stryke/types/base";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -16,19 +16,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
|
|
|
16
16
|
* Create a new Powerlines Engine instance
|
|
17
17
|
*
|
|
18
18
|
* @param options - The options to initialize the context with
|
|
19
|
+
* @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
|
|
19
20
|
* @returns A new instance of the Powerlines Engine
|
|
20
21
|
*/
|
|
21
|
-
static
|
|
22
|
+
static init(options: EngineOptions, initialConfig?: InitialConfig<any>): Promise<PowerlinesEngine>;
|
|
22
23
|
/**
|
|
23
24
|
* The Powerlines context
|
|
24
25
|
*/
|
|
25
26
|
get context(): EngineContext;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new Powerlines Engine instance
|
|
28
|
-
*
|
|
29
|
-
* @param context - The Powerlines context
|
|
30
|
-
*/
|
|
31
|
-
protected constructor(context: EngineContext);
|
|
32
27
|
/**
|
|
33
28
|
* Generate the Powerlines typescript declaration file
|
|
34
29
|
*
|
|
@@ -123,6 +118,12 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
|
|
|
123
118
|
* Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
|
|
124
119
|
*/
|
|
125
120
|
[Symbol.asyncDispose](): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Create a new Powerlines Engine instance
|
|
123
|
+
*
|
|
124
|
+
* @param context - The Powerlines context
|
|
125
|
+
*/
|
|
126
|
+
protected constructor(context: EngineContext);
|
|
126
127
|
/**
|
|
127
128
|
* Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
|
|
128
129
|
*
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAgEA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EA4DtC;;;;;;;EAAA,OA1CW,IAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,aAAA,QACd,OAAA,CAAQ,gBAAA;EAkFO;;;EAAA,IAzDP,OAAA,CAAA,GAAW,aAAA;EA0DhB;;;;;;;;EA9CO,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA2CG;;;;;;;;EAPO,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EAiC4B;;;;;;;;;EAAlB,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA6DpD;;;;;;;;;EAjCL,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EA+De;;;;;;EArCL,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAgGM;;;;;;;;;EAnEI,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAiJW;;;;;;;;;EApHD,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EAlQQ;;;;;;EA2RE,IAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,gBAAA,8BAIN,OAAA;EAtQmB;;;;;;;;EAqST,MAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,kBAAA,8BAIN,OAAA;EAnPe;;;;;;;;EAgRL,QAAA,CAAA,GAAQ,OAAA;EA7QH;;;EAAA,CA0RJ,MAAA,CAAO,YAAA,KAAa,OAAA;EAzRX;;;;;EAAA,UAkSd,WAAA,CAAa,OAAA,EAAS,aAAA;EAhSR;;;;;EAAA,QAyST,gBAAA;EAAA,QAuGA,cAAA;EAAA,QAsBA,kBAAA;EAAA,QAEA,gBAAA;EAAA,QAEA,mBAAA;AAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
1
|
+
import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, InitialConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
|
|
2
2
|
import { PartialKeys } from "@stryke/types/base";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
@@ -16,19 +16,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
|
|
|
16
16
|
* Create a new Powerlines Engine instance
|
|
17
17
|
*
|
|
18
18
|
* @param options - The options to initialize the context with
|
|
19
|
+
* @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
|
|
19
20
|
* @returns A new instance of the Powerlines Engine
|
|
20
21
|
*/
|
|
21
|
-
static
|
|
22
|
+
static init(options: EngineOptions, initialConfig?: InitialConfig<any>): Promise<PowerlinesEngine>;
|
|
22
23
|
/**
|
|
23
24
|
* The Powerlines context
|
|
24
25
|
*/
|
|
25
26
|
get context(): EngineContext;
|
|
26
|
-
/**
|
|
27
|
-
* Create a new Powerlines Engine instance
|
|
28
|
-
*
|
|
29
|
-
* @param context - The Powerlines context
|
|
30
|
-
*/
|
|
31
|
-
protected constructor(context: EngineContext);
|
|
32
27
|
/**
|
|
33
28
|
* Generate the Powerlines typescript declaration file
|
|
34
29
|
*
|
|
@@ -123,6 +118,12 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
|
|
|
123
118
|
* Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
|
|
124
119
|
*/
|
|
125
120
|
[Symbol.asyncDispose](): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Create a new Powerlines Engine instance
|
|
123
|
+
*
|
|
124
|
+
* @param context - The Powerlines context
|
|
125
|
+
*/
|
|
126
|
+
protected constructor(context: EngineContext);
|
|
126
127
|
/**
|
|
127
128
|
* Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
|
|
128
129
|
*
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAgEA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EA4DtC;;;;;;;EAAA,OA1CW,IAAA,CAClB,OAAA,EAAS,aAAA,EACT,aAAA,GAAe,aAAA,QACd,OAAA,CAAQ,gBAAA;EAkFO;;;EAAA,IAzDP,OAAA,CAAA,GAAW,aAAA;EA0DhB;;;;;;;;EA9CO,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA2CG;;;;;;;;EAPO,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EAiC4B;;;;;;;;;EAAlB,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA6DpD;;;;;;;;;EAjCL,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EA+De;;;;;;EArCL,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAgGM;;;;;;;;;EAnEI,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAiJW;;;;;;;;;EApHD,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EAlQQ;;;;;;EA2RE,IAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,gBAAA,8BAIN,OAAA;EAtQmB;;;;;;;;EAqST,MAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,kBAAA,8BAIN,OAAA;EAnPe;;;;;;;;EAgRL,QAAA,CAAA,GAAQ,OAAA;EA7QH;;;EAAA,CA0RJ,MAAA,CAAO,YAAA,KAAa,OAAA;EAzRX;;;;;EAAA,UAkSd,WAAA,CAAa,OAAA,EAAS,aAAA;EAhSR;;;;;EAAA,QAyST,gBAAA;EAAA,QAuGA,cAAA;EAAA,QAsBA,kBAAA;EAAA,QAEA,gBAAA;EAAA,QAEA,mBAAA;AAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "./engine-context-_RMFwG4J.mjs";
|
|
2
2
|
import { POWERLINES_API_FUNCTIONS } from "@powerlines/core/constants";
|
|
3
3
|
import { toArray } from "@stryke/convert/to-array";
|
|
4
4
|
import { resolvePackage } from "@stryke/fs/resolve";
|
|
@@ -408,10 +408,11 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
408
408
|
* Create a new Powerlines Engine instance
|
|
409
409
|
*
|
|
410
410
|
* @param options - The options to initialize the context with
|
|
411
|
+
* @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
|
|
411
412
|
* @returns A new instance of the Powerlines Engine
|
|
412
413
|
*/
|
|
413
|
-
static async
|
|
414
|
-
const api = new PowerlinesEngine(await PowerlinesEngineContext.
|
|
414
|
+
static async init(options, initialConfig = {}) {
|
|
415
|
+
const api = new PowerlinesEngine(await PowerlinesEngineContext.init(options, initialConfig));
|
|
415
416
|
const packagePath = await resolvePackage("@powerlines/engine");
|
|
416
417
|
if (!packagePath) throw new Error("Could not resolve `@powerlines/engine` package location.");
|
|
417
418
|
api.#worker = new Worker$1(joinPaths(packagePath, "./_internal/worker.mjs"), {
|
|
@@ -429,14 +430,6 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
429
430
|
return this.#context;
|
|
430
431
|
}
|
|
431
432
|
/**
|
|
432
|
-
* Create a new Powerlines Engine instance
|
|
433
|
-
*
|
|
434
|
-
* @param context - The Powerlines context
|
|
435
|
-
*/
|
|
436
|
-
constructor(context) {
|
|
437
|
-
this.#context = context;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
433
|
* Generate the Powerlines typescript declaration file
|
|
441
434
|
*
|
|
442
435
|
* @remarks
|
|
@@ -451,7 +444,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
451
444
|
inlineConfig.command ??= "types";
|
|
452
445
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
|
|
453
446
|
options: execution.options,
|
|
454
|
-
|
|
447
|
+
initialConfig: this.#context.initialConfig,
|
|
448
|
+
inlineConfig
|
|
455
449
|
})));
|
|
456
450
|
this.context.debug("✔ Powerlines types generation has completed successfully");
|
|
457
451
|
timer();
|
|
@@ -471,7 +465,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
471
465
|
inlineConfig.command ??= "prepare";
|
|
472
466
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
|
|
473
467
|
options: execution.options,
|
|
474
|
-
|
|
468
|
+
initialConfig: this.#context.initialConfig,
|
|
469
|
+
inlineConfig
|
|
475
470
|
})));
|
|
476
471
|
this.context.debug("✔ Powerlines preparation has completed successfully");
|
|
477
472
|
timer();
|
|
@@ -491,7 +486,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
491
486
|
inlineConfig.command ??= "new";
|
|
492
487
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
|
|
493
488
|
options: execution.options,
|
|
494
|
-
|
|
489
|
+
initialConfig: this.#context.initialConfig,
|
|
490
|
+
inlineConfig
|
|
495
491
|
})));
|
|
496
492
|
this.context.debug("✔ Powerlines new command completed successfully");
|
|
497
493
|
timer();
|
|
@@ -511,7 +507,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
511
507
|
inlineConfig.command ??= "clean";
|
|
512
508
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
|
|
513
509
|
options: execution.options,
|
|
514
|
-
|
|
510
|
+
initialConfig: this.#context.initialConfig,
|
|
511
|
+
inlineConfig
|
|
515
512
|
})));
|
|
516
513
|
this.context.debug("✔ Powerlines cleaning completed successfully");
|
|
517
514
|
timer();
|
|
@@ -528,7 +525,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
528
525
|
inlineConfig.command ??= "lint";
|
|
529
526
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
|
|
530
527
|
options: execution.options,
|
|
531
|
-
|
|
528
|
+
initialConfig: this.#context.initialConfig,
|
|
529
|
+
inlineConfig
|
|
532
530
|
})));
|
|
533
531
|
this.context.debug("✔ Powerlines linting completed successfully");
|
|
534
532
|
timer();
|
|
@@ -548,7 +546,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
548
546
|
inlineConfig.command ??= "test";
|
|
549
547
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
|
|
550
548
|
options: execution.options,
|
|
551
|
-
|
|
549
|
+
initialConfig: this.#context.initialConfig,
|
|
550
|
+
inlineConfig
|
|
552
551
|
})));
|
|
553
552
|
this.context.debug("✔ Powerlines testing completed successfully");
|
|
554
553
|
timer();
|
|
@@ -567,7 +566,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
567
566
|
this.context.info("📦 Building the Powerlines project");
|
|
568
567
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
|
|
569
568
|
options: execution.options,
|
|
570
|
-
|
|
569
|
+
initialConfig: this.#context.initialConfig,
|
|
570
|
+
inlineConfig
|
|
571
571
|
})));
|
|
572
572
|
this.context.debug("✔ Powerlines build completed successfully");
|
|
573
573
|
timer();
|
|
@@ -584,7 +584,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
584
584
|
inlineConfig.command ??= "docs";
|
|
585
585
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
|
|
586
586
|
options: execution.options,
|
|
587
|
-
|
|
587
|
+
initialConfig: this.#context.initialConfig,
|
|
588
|
+
inlineConfig
|
|
588
589
|
})));
|
|
589
590
|
this.context.debug("✔ Powerlines documentation generation completed successfully");
|
|
590
591
|
timer();
|
|
@@ -603,7 +604,8 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
603
604
|
inlineConfig.command ??= "deploy";
|
|
604
605
|
await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
|
|
605
606
|
options: execution.options,
|
|
606
|
-
|
|
607
|
+
initialConfig: this.#context.initialConfig,
|
|
608
|
+
inlineConfig
|
|
607
609
|
})));
|
|
608
610
|
this.context.debug("✔ Powerlines deploy completed successfully");
|
|
609
611
|
timer();
|
|
@@ -630,6 +632,14 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
630
632
|
return this.finalize();
|
|
631
633
|
}
|
|
632
634
|
/**
|
|
635
|
+
* Create a new Powerlines Engine instance
|
|
636
|
+
*
|
|
637
|
+
* @param context - The Powerlines context
|
|
638
|
+
*/
|
|
639
|
+
constructor(context) {
|
|
640
|
+
this.#context = context;
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
633
643
|
* Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
|
|
634
644
|
*
|
|
635
645
|
* @param message - The IPC message received from a worker process
|