@powerlines/engine 0.44.11 → 0.45.0
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 +141 -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 +142 -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-C-M-Mxse.cjs → execution-context-BFCOc0mH.cjs} +61 -48
- package/dist/{execution-context-D9Enw3J5.mjs → execution-context-Cr_VUBrP.mjs} +63 -50
- package/dist/execution-context-Cr_VUBrP.mjs.map +1 -0
- 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,12 @@ 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
|
+
initialConfig,
|
|
2031
2038
|
userConfig
|
|
2032
2039
|
};
|
|
2033
2040
|
}
|
|
@@ -2050,28 +2057,33 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2050
2057
|
] },
|
|
2051
2058
|
dts: true
|
|
2052
2059
|
});
|
|
2053
|
-
logger.trace(`Pre-setup Powerlines configuration object: \n${
|
|
2054
|
-
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
|
|
2061
|
+
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2062
|
+
"inlineConfig",
|
|
2063
|
+
"userConfig",
|
|
2064
|
+
"initialConfig",
|
|
2065
|
+
"pluginConfig",
|
|
2066
|
+
"plugins"
|
|
2067
|
+
]),
|
|
2068
|
+
inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2069
|
+
userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : void 0,
|
|
2070
|
+
initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2071
|
+
pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2072
|
+
})}`);
|
|
2073
|
+
if (!this.initialOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.initialConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
2060
2074
|
this.options.mode = "production";
|
|
2061
2075
|
this.config.mode = "production";
|
|
2062
2076
|
}
|
|
2063
|
-
if (!this.
|
|
2077
|
+
if (!this.initialOptions.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.initialConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
2064
2078
|
this.options.framework = "powerlines";
|
|
2065
2079
|
this.config.framework = "powerlines";
|
|
2066
2080
|
}
|
|
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.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2081
|
+
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.initialConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2082
|
+
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.initialConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2083
|
+
this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.initialConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2070
2084
|
this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
|
|
2071
2085
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
2072
2086
|
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
2087
|
if (this.config.resolve.external) this.config.resolve.external = (0, _stryke_helpers_get_unique.getUnique)(this.config.resolve.external);
|
|
2076
2088
|
if (this.config.resolve.noExternal) this.config.resolve.noExternal = (0, _stryke_helpers_get_unique.getUnique)(this.config.resolve.noExternal);
|
|
2077
2089
|
this.config.plugins = (this.config.plugins ?? []).flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin)).filter(Boolean).reduce((ret, plugin) => {
|
|
@@ -2079,10 +2091,10 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2079
2091
|
ret.push(plugin);
|
|
2080
2092
|
return ret;
|
|
2081
2093
|
}, []);
|
|
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;
|
|
2094
|
+
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
2095
|
else if (this.config.mode === "test") this.config.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
|
|
2084
2096
|
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);
|
|
2097
|
+
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
2098
|
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
2099
|
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
2100
|
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 +2104,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2092
2104
|
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
2105
|
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
2106
|
}
|
|
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);
|
|
2107
|
+
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
2108
|
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
2109
|
return {
|
|
2098
2110
|
glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
|
|
@@ -2101,11 +2113,11 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2101
2113
|
ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
|
|
2102
2114
|
};
|
|
2103
2115
|
}), (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;
|
|
2116
|
+
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
2117
|
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;
|
|
2118
|
+
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
2119
|
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"}`;
|
|
2120
|
+
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
2121
|
if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
|
|
2110
2122
|
...asset,
|
|
2111
2123
|
glob: (0, _powerlines_core_plugin_utils.replacePathTokens)(this, asset.glob),
|
|
@@ -2115,24 +2127,24 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
|
|
|
2115
2127
|
}));
|
|
2116
2128
|
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
2129
|
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
|
-
|
|
2130
|
+
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)({
|
|
2131
|
+
...(0, _stryke_helpers_omit.omit)(this.config, [
|
|
2132
|
+
"inlineConfig",
|
|
2133
|
+
"userConfig",
|
|
2134
|
+
"initialConfig",
|
|
2135
|
+
"pluginConfig",
|
|
2136
|
+
"plugins"
|
|
2137
|
+
]),
|
|
2138
|
+
inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2139
|
+
userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.userConfig) ? (0, _stryke_helpers_omit.omit)(this.config.userConfig, ["plugins"]) : void 0,
|
|
2140
|
+
initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2141
|
+
pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2142
|
+
})}`);
|
|
2124
2143
|
}
|
|
2125
2144
|
};
|
|
2126
2145
|
|
|
2127
2146
|
//#endregion
|
|
2128
2147
|
//#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
2148
|
/**
|
|
2137
2149
|
* Merges the current hook result with the previous results based on their types.
|
|
2138
2150
|
*
|
|
@@ -2143,7 +2155,7 @@ const mergeResultObjects = (0, defu.createDefu)((obj, key, value) => {
|
|
|
2143
2155
|
function mergeResults(currentResult, previousResults) {
|
|
2144
2156
|
if (!previousResults || previousResults.length === 0) return [currentResult];
|
|
2145
2157
|
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 = [
|
|
2158
|
+
else if ((0, _stryke_type_checks_is_object.isObject)(currentResult)) previousResults = previousResults.length > 0 ? [(0, defu.defu)(currentResult, previousResults[0])] : [currentResult];
|
|
2147
2159
|
return previousResults;
|
|
2148
2160
|
}
|
|
2149
2161
|
/**
|
|
@@ -2521,9 +2533,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2521
2533
|
* @param options - The options for resolving the context.
|
|
2522
2534
|
* @returns A promise that resolves to the new context.
|
|
2523
2535
|
*/
|
|
2524
|
-
static async
|
|
2536
|
+
static async init(options, initialConfig) {
|
|
2525
2537
|
const context = new PowerlinesExecutionContext(options);
|
|
2526
|
-
await context.init(options);
|
|
2538
|
+
await context.init(options, initialConfig);
|
|
2527
2539
|
const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
|
|
2528
2540
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
2529
2541
|
context.powerlinesPath = powerlinesPath;
|
|
@@ -2535,10 +2547,10 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2535
2547
|
* @param options - The options for resolving the context.
|
|
2536
2548
|
* @returns A promise that resolves to the new context.
|
|
2537
2549
|
*/
|
|
2538
|
-
static async
|
|
2550
|
+
static async inline(options, initialConfig, inlineConfig) {
|
|
2539
2551
|
const context = new PowerlinesExecutionContext(options);
|
|
2540
|
-
await context.init(options);
|
|
2541
|
-
context.config.inlineConfig =
|
|
2552
|
+
await context.init(options, initialConfig);
|
|
2553
|
+
context.config.inlineConfig = inlineConfig;
|
|
2542
2554
|
if (context.config.inlineConfig.command === "new") {
|
|
2543
2555
|
const workspacePackageJsonPath = (0, _stryke_path_join.joinPaths)(context.config.cwd, "package.json");
|
|
2544
2556
|
if (!(0, _stryke_fs_exists.existsSync)(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
|
|
@@ -2632,8 +2644,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2632
2644
|
* @returns A promise that resolves to the cloned context.
|
|
2633
2645
|
*/
|
|
2634
2646
|
async clone() {
|
|
2635
|
-
const clone = await PowerlinesExecutionContext.
|
|
2647
|
+
const clone = await PowerlinesExecutionContext.init(this.options, this.initialConfig);
|
|
2636
2648
|
clone.config.userConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.userConfig);
|
|
2649
|
+
clone.config.initialConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.initialConfig);
|
|
2637
2650
|
clone.config.inlineConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.inlineConfig);
|
|
2638
2651
|
clone.config.pluginConfig = (0, _stryke_helpers_deep_clone.deepClone)(this.config.pluginConfig);
|
|
2639
2652
|
await clone.setup();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-BSAC5sO9.mjs";
|
|
2
2
|
import { a as FileSystem } from "./fs-D1nIP45P.mjs";
|
|
3
3
|
import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-CYGZHTDd.mjs";
|
|
4
4
|
import { i as getTsconfigFilePath } from "./tsconfig-CI6bla4E.mjs";
|
|
@@ -18,10 +18,11 @@ import { appendPath } from "@stryke/path/append";
|
|
|
18
18
|
import { isEqual } from "@stryke/path/is-equal";
|
|
19
19
|
import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
20
20
|
import chalk from "chalk";
|
|
21
|
-
import defu, {
|
|
21
|
+
import defu, { defu as defu$1 } from "defu";
|
|
22
22
|
import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
|
|
23
23
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
24
24
|
import { format } from "@powerlines/core/lib/utilities/format";
|
|
25
|
+
import { formatLogMessage } from "@storm-software/config-tools/logger/console";
|
|
25
26
|
import { existsSync } from "@stryke/fs/exists";
|
|
26
27
|
import { getUnique, getUniqueBy } from "@stryke/helpers/get-unique";
|
|
27
28
|
import { omit } from "@stryke/helpers/omit";
|
|
@@ -1302,9 +1303,9 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1302
1303
|
* @param options - The options for resolving the context.
|
|
1303
1304
|
* @returns A promise that resolves to the new context.
|
|
1304
1305
|
*/
|
|
1305
|
-
static async
|
|
1306
|
+
static async init(options, initialConfig) {
|
|
1306
1307
|
const context = new PowerlinesContext(options);
|
|
1307
|
-
await context.init(options);
|
|
1308
|
+
await context.init(options, initialConfig);
|
|
1308
1309
|
const powerlinesPath = await resolvePackage("powerlines");
|
|
1309
1310
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
1310
1311
|
context.powerlinesPath = powerlinesPath;
|
|
@@ -1607,7 +1608,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1607
1608
|
* @returns A promise that resolves to the cloned context.
|
|
1608
1609
|
*/
|
|
1609
1610
|
async clone() {
|
|
1610
|
-
const clone = await PowerlinesContext.
|
|
1611
|
+
const clone = await PowerlinesContext.init(this.options, this.initialConfig);
|
|
1611
1612
|
return this.copyTo(clone);
|
|
1612
1613
|
}
|
|
1613
1614
|
/**
|
|
@@ -1961,8 +1962,9 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1961
1962
|
cwd: this.options.cwd,
|
|
1962
1963
|
inlineConfig: this.config.inlineConfig ?? {},
|
|
1963
1964
|
userConfig: this.config.userConfig ?? {},
|
|
1965
|
+
initialConfig: this.config.initialConfig ?? {},
|
|
1964
1966
|
pluginConfig: this.config.pluginConfig ?? {}
|
|
1965
|
-
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
1967
|
+
}, getConfigProps(this.config.inlineConfig), getConfigProps(this.config.userConfig), getConfigProps(this.config.initialConfig), getConfigProps(this.config.pluginConfig), this.options, {
|
|
1966
1968
|
name: this.projectJson?.name || this.packageJson?.name,
|
|
1967
1969
|
version: this.packageJson?.version,
|
|
1968
1970
|
description: this.packageJson?.description
|
|
@@ -1987,7 +1989,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1987
1989
|
copyTo(context) {
|
|
1988
1990
|
for (const [key, value] of Object.entries(this)) if (!SKIP_CLONING_PROPS.includes(key)) if (isObject(value) || Array.isArray(value)) context[key] = deepClone(value);
|
|
1989
1991
|
else context[key] = value;
|
|
1990
|
-
context.
|
|
1992
|
+
context.initialConfig = deepClone(this.initialConfig);
|
|
1993
|
+
context.initialOptions = deepClone(this.initialOptions);
|
|
1991
1994
|
context.options = deepClone(this.options);
|
|
1992
1995
|
context.dependencies = deepClone(this.dependencies);
|
|
1993
1996
|
context.devDependencies = deepClone(this.devDependencies);
|
|
@@ -2008,8 +2011,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2008
2011
|
*
|
|
2009
2012
|
* @param options - The configuration options to initialize the context with
|
|
2010
2013
|
*/
|
|
2011
|
-
async init(options) {
|
|
2012
|
-
await super.init(options);
|
|
2014
|
+
async init(options, initialConfig) {
|
|
2015
|
+
await super.init(options, initialConfig ?? {});
|
|
2013
2016
|
this.options.executionId = options.executionId ?? this.options.executionId;
|
|
2014
2017
|
this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
|
|
2015
2018
|
const projectJsonPath = joinPaths(this.options.cwd, this.options.root, "project.json");
|
|
@@ -2022,8 +2025,12 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2022
2025
|
this.#checksum = await this.generateChecksum(joinPaths(this.options.cwd, this.options.root));
|
|
2023
2026
|
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 : {};
|
|
2024
2027
|
this.resolvedConfig = {
|
|
2025
|
-
|
|
2028
|
+
cwd: this.options.cwd,
|
|
2029
|
+
root: this.options.root,
|
|
2030
|
+
...this.initialOptions,
|
|
2031
|
+
...initialConfig,
|
|
2026
2032
|
...userConfig,
|
|
2033
|
+
initialConfig,
|
|
2027
2034
|
userConfig
|
|
2028
2035
|
};
|
|
2029
2036
|
}
|
|
@@ -2046,28 +2053,33 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2046
2053
|
] },
|
|
2047
2054
|
dts: true
|
|
2048
2055
|
});
|
|
2049
|
-
logger.trace(`Pre-setup Powerlines configuration object: \n${
|
|
2050
|
-
...omit(this.config, [
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
+
logger.trace(`Pre-setup Powerlines configuration object: \n${formatLogMessage({
|
|
2057
|
+
...omit(this.config, [
|
|
2058
|
+
"inlineConfig",
|
|
2059
|
+
"userConfig",
|
|
2060
|
+
"initialConfig",
|
|
2061
|
+
"pluginConfig",
|
|
2062
|
+
"plugins"
|
|
2063
|
+
]),
|
|
2064
|
+
inlineConfig: isSetObject(this.config.inlineConfig) ? omit(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2065
|
+
userConfig: isSetObject(this.config.userConfig) ? omit(this.config.userConfig, ["plugins"]) : void 0,
|
|
2066
|
+
initialConfig: isSetObject(this.config.initialConfig) ? omit(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2067
|
+
pluginConfig: isSetObject(this.config.pluginConfig) ? omit(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2068
|
+
})}`);
|
|
2069
|
+
if (!this.initialOptions.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.initialConfig?.mode && !this.config.pluginConfig?.mode) {
|
|
2056
2070
|
this.options.mode = "production";
|
|
2057
2071
|
this.config.mode = "production";
|
|
2058
2072
|
}
|
|
2059
|
-
if (!this.
|
|
2073
|
+
if (!this.initialOptions.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.initialConfig?.framework && !this.config.pluginConfig?.framework) {
|
|
2060
2074
|
this.options.framework = "powerlines";
|
|
2061
2075
|
this.config.framework = "powerlines";
|
|
2062
2076
|
}
|
|
2063
|
-
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2064
|
-
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2065
|
-
this.resolvedConfig.compatibilityDate = resolveCompatibilityDates(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2077
|
+
if (!this.config.userConfig?.projectType && !this.config.inlineConfig?.projectType && !this.config.initialConfig?.projectType && !this.config.pluginConfig?.projectType) this.config.projectType = "application";
|
|
2078
|
+
if (!this.config.userConfig?.platform && !this.config.inlineConfig?.platform && !this.config.initialConfig?.platform && !this.config.pluginConfig?.platform) this.config.platform = "neutral";
|
|
2079
|
+
this.resolvedConfig.compatibilityDate = resolveCompatibilityDates(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.initialConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
|
|
2066
2080
|
this.config.input = getUniqueInputs(this.config.input);
|
|
2067
2081
|
if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
|
|
2068
2082
|
this.config.title ??= titleCase(this.config.name);
|
|
2069
|
-
if (this.config.userConfig.resolve?.external) this.config.userConfig.resolve.external = getUnique(this.config.userConfig.resolve.external);
|
|
2070
|
-
if (this.config.userConfig.resolve?.noExternal) this.config.userConfig.resolve.noExternal = getUnique(this.config.userConfig.resolve.noExternal);
|
|
2071
2083
|
if (this.config.resolve.external) this.config.resolve.external = getUnique(this.config.resolve.external);
|
|
2072
2084
|
if (this.config.resolve.noExternal) this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
|
|
2073
2085
|
this.config.plugins = (this.config.plugins ?? []).flatMap((plugin) => toArray(plugin)).filter(Boolean).reduce((ret, plugin) => {
|
|
@@ -2075,10 +2087,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2075
2087
|
ret.push(plugin);
|
|
2076
2088
|
return ret;
|
|
2077
2089
|
}, []);
|
|
2078
|
-
if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2090
|
+
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 = DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2079
2091
|
else if (this.config.mode === "test") this.config.logLevel = DEFAULT_TEST_LOG_LEVEL;
|
|
2080
2092
|
else this.config.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
2081
|
-
if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
2093
|
+
if (!this.config.userConfig?.tsconfig && !this.config.initialConfig?.tsconfig && !this.config.pluginConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.config.cwd, this.config.root);
|
|
2082
2094
|
else if (this.config.tsconfig) this.config.tsconfig = replacePath(replacePathTokens(this, this.config.tsconfig), this.config.cwd);
|
|
2083
2095
|
this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
2084
2096
|
if (this.config.output.path) this.config.output.path = appendPath(replacePathTokens(this, this.config.output.path), this.config.cwd);
|
|
@@ -2088,7 +2100,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2088
2100
|
if (!this.config.root.replace(/^\.\/?/, "")) this.config.output.copy.path = this.config.output.copy.path ? appendPath(replacePathTokens(this, this.config.output.copy.path), this.config.cwd) : this.config.output.path;
|
|
2089
2101
|
else this.config.output.copy.path = appendPath(replacePathTokens(this, this.config.output.copy.path || joinPaths("dist", this.config.root)), this.config.cwd);
|
|
2090
2102
|
}
|
|
2091
|
-
if (this.config.output.types !== false) this.config.output.types = appendPath(replacePathTokens(this, this.config.userConfig?.output?.types || this.config.inlineConfig?.output?.types || this.config.pluginConfig?.output?.types || joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
2103
|
+
if (this.config.output.types !== false) this.config.output.types = appendPath(replacePathTokens(this, this.config.userConfig?.output?.types || this.config.inlineConfig?.output?.types || this.config.initialConfig?.output?.types || this.config.pluginConfig?.output?.types || joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
|
|
2092
2104
|
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 = getUniqueBy(this.config.output.copy.assets.map((asset) => {
|
|
2093
2105
|
return {
|
|
2094
2106
|
glob: isSetObject(asset) ? asset.glob : asset,
|
|
@@ -2097,11 +2109,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2097
2109
|
ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
|
|
2098
2110
|
};
|
|
2099
2111
|
}), (a) => `${a.input}-${a.glob}-${a.output}`);
|
|
2100
|
-
if (!this.config.userConfig?.output?.sourceMap && !this.config.inlineConfig?.output?.sourceMap) if (this.config.mode === "development") this.config.output.sourceMap = true;
|
|
2112
|
+
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;
|
|
2101
2113
|
else this.config.output.sourceMap = false;
|
|
2102
|
-
if (!this.config.userConfig?.output?.minify && !this.config.inlineConfig?.output?.minify) if (this.config.mode === "production") this.config.output.minify = true;
|
|
2114
|
+
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;
|
|
2103
2115
|
else this.config.output.minify = false;
|
|
2104
|
-
if (!this.config.userConfig?.output?.artifactsPath && !this.config.inlineConfig?.output?.artifactsPath && !this.config.pluginConfig?.output?.artifactsPath) this.config.output.artifactsPath = `.${this.config.framework || "powerlines"}`;
|
|
2116
|
+
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"}`;
|
|
2105
2117
|
if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
|
|
2106
2118
|
...asset,
|
|
2107
2119
|
glob: replacePathTokens(this, asset.glob),
|
|
@@ -2111,24 +2123,24 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2111
2123
|
}));
|
|
2112
2124
|
if (isSetString(this.config.output?.storage) && this.config.output.storage === "virtual" || isSetObject(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
|
|
2113
2125
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2114
|
-
if (isSetObject(this.config.userConfig) && isSetObject(this.config.
|
|
2115
|
-
...omit(this.config, [
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2126
|
+
if (isSetObject(this.config.inlineConfig) && isSetObject(this.config.userConfig) && isSetObject(this.config.initialConfig) && isSetObject(this.config.pluginConfig)) logger.debug(`Resolved Powerlines configuration object: \n${formatLogMessage({
|
|
2127
|
+
...omit(this.config, [
|
|
2128
|
+
"inlineConfig",
|
|
2129
|
+
"userConfig",
|
|
2130
|
+
"initialConfig",
|
|
2131
|
+
"pluginConfig",
|
|
2132
|
+
"plugins"
|
|
2133
|
+
]),
|
|
2134
|
+
inlineConfig: isSetObject(this.config.inlineConfig) ? omit(this.config.inlineConfig, ["plugins"]) : void 0,
|
|
2135
|
+
userConfig: isSetObject(this.config.userConfig) ? omit(this.config.userConfig, ["plugins"]) : void 0,
|
|
2136
|
+
initialConfig: isSetObject(this.config.initialConfig) ? omit(this.config.initialConfig, ["plugins"]) : void 0,
|
|
2137
|
+
pluginConfig: isSetObject(this.config.pluginConfig) ? omit(this.config.pluginConfig, ["plugins"]) : void 0
|
|
2138
|
+
})}`);
|
|
2120
2139
|
}
|
|
2121
2140
|
};
|
|
2122
2141
|
|
|
2123
2142
|
//#endregion
|
|
2124
2143
|
//#region src/_internal/helpers/hooks.ts
|
|
2125
|
-
const mergeResultObjects = createDefu((obj, key, value) => {
|
|
2126
|
-
if (isString(obj[key]) && isString(value)) {
|
|
2127
|
-
obj[key] = `${obj[key] || ""}\n${value || ""}`.trim();
|
|
2128
|
-
return true;
|
|
2129
|
-
}
|
|
2130
|
-
return false;
|
|
2131
|
-
});
|
|
2132
2144
|
/**
|
|
2133
2145
|
* Merges the current hook result with the previous results based on their types.
|
|
2134
2146
|
*
|
|
@@ -2139,7 +2151,7 @@ const mergeResultObjects = createDefu((obj, key, value) => {
|
|
|
2139
2151
|
function mergeResults(currentResult, previousResults) {
|
|
2140
2152
|
if (!previousResults || previousResults.length === 0) return [currentResult];
|
|
2141
2153
|
if (isSetString(currentResult)) previousResults = [`${isSetString(previousResults[0]) ? previousResults[0] || "" : ""}\n${isSetString(previousResults[0]) ? currentResult.replace(previousResults[0], "") : currentResult}`.trim()];
|
|
2142
|
-
else if (isObject(currentResult)) previousResults = [
|
|
2154
|
+
else if (isObject(currentResult)) previousResults = previousResults.length > 0 ? [defu$1(currentResult, previousResults[0])] : [currentResult];
|
|
2143
2155
|
return previousResults;
|
|
2144
2156
|
}
|
|
2145
2157
|
/**
|
|
@@ -2517,9 +2529,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2517
2529
|
* @param options - The options for resolving the context.
|
|
2518
2530
|
* @returns A promise that resolves to the new context.
|
|
2519
2531
|
*/
|
|
2520
|
-
static async
|
|
2532
|
+
static async init(options, initialConfig) {
|
|
2521
2533
|
const context = new PowerlinesExecutionContext(options);
|
|
2522
|
-
await context.init(options);
|
|
2534
|
+
await context.init(options, initialConfig);
|
|
2523
2535
|
const powerlinesPath = await resolvePackage("powerlines");
|
|
2524
2536
|
if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
|
|
2525
2537
|
context.powerlinesPath = powerlinesPath;
|
|
@@ -2531,10 +2543,10 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2531
2543
|
* @param options - The options for resolving the context.
|
|
2532
2544
|
* @returns A promise that resolves to the new context.
|
|
2533
2545
|
*/
|
|
2534
|
-
static async
|
|
2546
|
+
static async inline(options, initialConfig, inlineConfig) {
|
|
2535
2547
|
const context = new PowerlinesExecutionContext(options);
|
|
2536
|
-
await context.init(options);
|
|
2537
|
-
context.config.inlineConfig =
|
|
2548
|
+
await context.init(options, initialConfig);
|
|
2549
|
+
context.config.inlineConfig = inlineConfig;
|
|
2538
2550
|
if (context.config.inlineConfig.command === "new") {
|
|
2539
2551
|
const workspacePackageJsonPath = joinPaths(context.config.cwd, "package.json");
|
|
2540
2552
|
if (!existsSync(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
|
|
@@ -2628,8 +2640,9 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2628
2640
|
* @returns A promise that resolves to the cloned context.
|
|
2629
2641
|
*/
|
|
2630
2642
|
async clone() {
|
|
2631
|
-
const clone = await PowerlinesExecutionContext.
|
|
2643
|
+
const clone = await PowerlinesExecutionContext.init(this.options, this.initialConfig);
|
|
2632
2644
|
clone.config.userConfig = deepClone(this.config.userConfig);
|
|
2645
|
+
clone.config.initialConfig = deepClone(this.config.initialConfig);
|
|
2633
2646
|
clone.config.inlineConfig = deepClone(this.config.inlineConfig);
|
|
2634
2647
|
clone.config.pluginConfig = deepClone(this.config.pluginConfig);
|
|
2635
2648
|
await clone.setup();
|
|
@@ -2721,4 +2734,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2721
2734
|
|
|
2722
2735
|
//#endregion
|
|
2723
2736
|
export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
|
|
2724
|
-
//# sourceMappingURL=execution-context-
|
|
2737
|
+
//# sourceMappingURL=execution-context-Cr_VUBrP.mjs.map
|