@powerlines/engine 0.46.3 → 0.46.5
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 +71 -44
- package/dist/_internal/worker.mjs +73 -46
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +5 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +1 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +5 -1
- package/dist/api.mjs.map +1 -1
- package/dist/{base-context-D7G_24-i.cjs → base-context-CbFlRUd-.cjs} +8 -6
- package/dist/{base-context-DU0NRHDt.mjs → base-context-Ce9PuQ9z.mjs} +9 -7
- package/dist/{base-context-DU0NRHDt.mjs.map → base-context-Ce9PuQ9z.mjs.map} +1 -1
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +3 -3
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +3 -3
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-BvDfqfY7.mjs → engine-context-CEbC9dHR.mjs} +2 -2
- package/dist/{engine-context-BvDfqfY7.mjs.map → engine-context-CEbC9dHR.mjs.map} +1 -1
- package/dist/{engine-context-BuJQY312.cjs → engine-context-D-rpz-J2.cjs} +1 -1
- package/dist/{execution-context-BpRfsnkE.d.mts → execution-context-CghMd-eP.d.cts} +9 -5
- package/dist/execution-context-CghMd-eP.d.cts.map +1 -0
- package/dist/{execution-context-Cu_xPYxI.mjs → execution-context-D-djno_x.mjs} +66 -46
- package/dist/execution-context-D-djno_x.mjs.map +1 -0
- package/dist/{execution-context-xj0KA802.cjs → execution-context-Lj_23Ps4.cjs} +60 -40
- package/dist/{execution-context-CodQucFX.d.cts → execution-context-rKd-zSZy.d.mts} +9 -5
- package/dist/execution-context-rKd-zSZy.d.mts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/storage/index.d.mts +1 -1
- package/dist/typescript/index.d.mts +1 -1
- package/package.json +3 -3
- package/dist/execution-context-BpRfsnkE.d.mts.map +0 -1
- package/dist/execution-context-CodQucFX.d.cts.map +0 -1
- package/dist/execution-context-Cu_xPYxI.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { t as PowerlinesBaseContext } from "./base-context-
|
|
1
|
+
import { t as PowerlinesBaseContext } from "./base-context-Ce9PuQ9z.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-MeFEs21S.mjs";
|
|
5
|
-
import { CACHE_HASH_LENGTH, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, PLUGIN_NON_HOOK_FIELDS, ROOT_HASH_LENGTH } from "@powerlines/core/constants";
|
|
5
|
+
import { CACHE_HASH_LENGTH, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, LogCategories, PLUGIN_NON_HOOK_FIELDS, ROOT_HASH_LENGTH } from "@powerlines/core/constants";
|
|
6
6
|
import { toArray } from "@stryke/convert/to-array";
|
|
7
7
|
import { getResolutionCombinations, resolve, resolveSync } from "@stryke/fs/resolve";
|
|
8
8
|
import { joinPaths } from "@stryke/path/join";
|
|
@@ -12,7 +12,7 @@ import { isString } from "@stryke/type-checks/is-string";
|
|
|
12
12
|
import { messageParent } from "jest-worker";
|
|
13
13
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
14
14
|
import { uuid } from "@stryke/unique-id/uuid";
|
|
15
|
-
import { addPluginHook, createLogger, dedupeHooklist, isDuplicate, isPlugin, isPluginConfig, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
|
|
15
|
+
import { addPluginHook, createLogger, dedupeHooklist, getPackageJsonOrganization, isDuplicate, isPlugin, isPluginConfig, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
|
|
16
16
|
import { colorText } from "@powerlines/core/plugin-utils/logging";
|
|
17
17
|
import { getEnvPaths } from "@stryke/env/get-env-paths";
|
|
18
18
|
import { appendPath } from "@stryke/path/append";
|
|
@@ -20,10 +20,10 @@ import { replaceExtension, replacePath } from "@stryke/path/replace";
|
|
|
20
20
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
21
21
|
import chalk from "chalk";
|
|
22
22
|
import defu, { defu as defu$1 } from "defu";
|
|
23
|
+
import { existsSync } from "node:fs";
|
|
23
24
|
import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
|
|
24
25
|
import { format } from "@powerlines/core/lib/utilities/format";
|
|
25
|
-
import {
|
|
26
|
-
import { existsSync } from "@stryke/fs/exists";
|
|
26
|
+
import { existsSync as existsSync$1 } from "@stryke/fs/exists";
|
|
27
27
|
import { getUnique, getUniqueBy } from "@stryke/helpers/get-unique";
|
|
28
28
|
import { omit } from "@stryke/helpers/omit";
|
|
29
29
|
import { findFileDotExtensionSafe, findFileExtensionSafe, findFileName, findFilePath, hasFileExtension } from "@stryke/path/file-path-fns";
|
|
@@ -31,7 +31,6 @@ import { isParentPath } from "@stryke/path/is-parent-path";
|
|
|
31
31
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
32
32
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
33
33
|
import { isObject } from "@stryke/type-checks/is-object";
|
|
34
|
-
import { isPromise } from "@stryke/type-checks/is-promise";
|
|
35
34
|
import { readJsonFile } from "@stryke/fs/json";
|
|
36
35
|
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
37
36
|
import { getUniqueInputs, isTypeDefinition, resolveInputsSync } from "@powerlines/core/lib/entry";
|
|
@@ -40,13 +39,14 @@ import { murmurhash } from "@stryke/hash";
|
|
|
40
39
|
import { hashDirectory } from "@stryke/hash/node";
|
|
41
40
|
import { fetchRequest } from "@stryke/http/fetch";
|
|
42
41
|
import { isEqual } from "@stryke/path/is-equal";
|
|
42
|
+
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
43
|
+
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
43
44
|
import { match, tsconfigPathsToRegExp } from "bundle-require";
|
|
44
45
|
import { resolveCompatibilityDates } from "compatx";
|
|
45
46
|
import { create } from "flat-cache";
|
|
46
47
|
import { parse } from "oxc-parser";
|
|
47
48
|
import { Agent, Response, interceptors, setGlobalDispatcher } from "undici";
|
|
48
49
|
import "@stryke/fs/remove-file";
|
|
49
|
-
import { LogCategories } from "@powerlines/core";
|
|
50
50
|
import * as capnp from "@stryke/capnp";
|
|
51
51
|
import { readFileBuffer, readFileBufferSync, writeFileBuffer } from "@stryke/fs/buffer";
|
|
52
52
|
import { correctPath, stripStars } from "@stryke/path/correct-path";
|
|
@@ -54,7 +54,6 @@ import { globToRegex } from "@stryke/path/glob-to-regex";
|
|
|
54
54
|
import { isAbsolutePath } from "@stryke/path/is-type";
|
|
55
55
|
import { slash } from "@stryke/path/slash";
|
|
56
56
|
import { prettyBytes } from "@stryke/string-format/pretty-bytes";
|
|
57
|
-
import { isRegExp } from "@stryke/type-checks/is-regexp";
|
|
58
57
|
import { Blob } from "node:buffer";
|
|
59
58
|
import { fileURLToPath } from "node:url";
|
|
60
59
|
import { getField } from "@stryke/helpers/get-field";
|
|
@@ -496,7 +495,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
496
495
|
static async create(context) {
|
|
497
496
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
498
497
|
let result;
|
|
499
|
-
if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
|
|
498
|
+
if (!context.config.skipCache && existsSync$1(joinPaths(context.dataPath, "fs.bin"))) {
|
|
500
499
|
const buffer = await readFileBuffer(joinPaths(context.dataPath, "fs.bin"));
|
|
501
500
|
const fs = new capnp.Message(buffer, false).getRoot(FileSystem);
|
|
502
501
|
result = new VirtualFileSystem(context, fs);
|
|
@@ -530,7 +529,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
530
529
|
static createSync(context) {
|
|
531
530
|
context.debug("Starting virtual file system (VFS) initialization processes...");
|
|
532
531
|
let result;
|
|
533
|
-
if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
|
|
532
|
+
if (!context.config.skipCache && existsSync$1(joinPaths(context.dataPath, "fs.bin"))) {
|
|
534
533
|
const buffer = readFileBufferSync(joinPaths(context.dataPath, "fs.bin"));
|
|
535
534
|
const fs = new capnp.Message(buffer, false).getRoot(FileSystem);
|
|
536
535
|
result = new VirtualFileSystem(context, fs);
|
|
@@ -1288,7 +1287,8 @@ const UNRESOLVED_CONFIG_NAMES = [
|
|
|
1288
1287
|
"initialConfig",
|
|
1289
1288
|
"userConfig",
|
|
1290
1289
|
"inlineConfig",
|
|
1291
|
-
"pluginConfig"
|
|
1290
|
+
"pluginConfig",
|
|
1291
|
+
"environmentConfig"
|
|
1292
1292
|
];
|
|
1293
1293
|
var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
1294
1294
|
#checksum = null;
|
|
@@ -1355,6 +1355,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1355
1355
|
*/
|
|
1356
1356
|
pluginConfig = {};
|
|
1357
1357
|
/**
|
|
1358
|
+
* The configuration options provided by the environment
|
|
1359
|
+
*/
|
|
1360
|
+
environmentConfig = {};
|
|
1361
|
+
/**
|
|
1358
1362
|
* The resolved entry type definitions for the project
|
|
1359
1363
|
*/
|
|
1360
1364
|
get entry() {
|
|
@@ -1936,7 +1940,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1936
1940
|
* @returns A promise that resolves when the inline configuration values have been set.
|
|
1937
1941
|
*/
|
|
1938
1942
|
async setInlineConfig(config) {
|
|
1939
|
-
this.logger.
|
|
1943
|
+
this.logger.debug({
|
|
1940
1944
|
meta: { category: "config" },
|
|
1941
1945
|
message: `Updating inline configuration object: \n${this.logConfig(config)}`
|
|
1942
1946
|
});
|
|
@@ -1950,7 +1954,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1950
1954
|
* @returns A promise that resolves when the plugin configuration values have been set.
|
|
1951
1955
|
*/
|
|
1952
1956
|
async setPluginConfig(config) {
|
|
1953
|
-
this.logger.
|
|
1957
|
+
this.logger.debug({
|
|
1954
1958
|
meta: { category: "config" },
|
|
1955
1959
|
message: `Updating plugin configuration object: \n${this.logConfig(config)}`
|
|
1956
1960
|
});
|
|
@@ -1966,21 +1970,21 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1966
1970
|
return mergeConfig({
|
|
1967
1971
|
mode: this.initialOptions.mode,
|
|
1968
1972
|
framework: this.initialOptions.framework,
|
|
1969
|
-
initialOptions: this.initialOptions,
|
|
1970
1973
|
logLevel: this.initialOptions.logLevel,
|
|
1971
|
-
options: this.options,
|
|
1972
1974
|
inlineConfig: this.inlineConfig,
|
|
1973
1975
|
userConfig: this.userConfig,
|
|
1974
1976
|
initialConfig: this.initialConfig,
|
|
1975
|
-
pluginConfig: this.pluginConfig
|
|
1977
|
+
pluginConfig: this.pluginConfig,
|
|
1978
|
+
environmentConfig: this.environmentConfig
|
|
1976
1979
|
}, getConfigProps(this.overriddenConfig), omit(this.options, [
|
|
1980
|
+
"name",
|
|
1977
1981
|
"mode",
|
|
1978
1982
|
"framework",
|
|
1979
1983
|
"logLevel"
|
|
1980
1984
|
]), getConfigProps(this.inlineConfig), getConfigProps(this.userConfig), getConfigProps(this.initialConfig), getConfigProps(this.pluginConfig), {
|
|
1985
|
+
name: this.initialOptions.name,
|
|
1981
1986
|
version: this.packageJson?.version,
|
|
1982
|
-
description: this.packageJson?.description
|
|
1983
|
-
}, {
|
|
1987
|
+
description: this.packageJson?.description,
|
|
1984
1988
|
environments: {},
|
|
1985
1989
|
resolve: {}
|
|
1986
1990
|
});
|
|
@@ -1992,7 +1996,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
1992
1996
|
* @returns A promise that resolves when the user configuration values have been set.
|
|
1993
1997
|
*/
|
|
1994
1998
|
async setUserConfig(config) {
|
|
1995
|
-
this.logger.
|
|
1999
|
+
this.logger.debug({
|
|
1996
2000
|
meta: { category: "config" },
|
|
1997
2001
|
message: `Updating user configuration object: \n${this.logConfig(config)}`
|
|
1998
2002
|
});
|
|
@@ -2031,7 +2035,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2031
2035
|
const mergedConfig = this.mergeConfig();
|
|
2032
2036
|
this.logger.trace({
|
|
2033
2037
|
meta: { category: "config" },
|
|
2034
|
-
message: `Pre-setup Powerlines configuration object: \n ---
|
|
2038
|
+
message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${this.logConfig(mergedConfig)} \n\n --- Initial Options --- \n${this.logConfig(this.initialOptions)} \n\n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n\n --- User Config --- \n${this.logConfig(this.userConfig)} \n\n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)} \n\n --- Environment Config --- \n${this.logConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n${this.logConfig(this.overriddenConfig)}`
|
|
2035
2039
|
});
|
|
2036
2040
|
mergedConfig.output = defu(mergedConfig.output ?? {}, {
|
|
2037
2041
|
copy: { assets: [
|
|
@@ -2047,14 +2051,17 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2047
2051
|
] },
|
|
2048
2052
|
dts: true
|
|
2049
2053
|
});
|
|
2050
|
-
if (
|
|
2051
|
-
if (
|
|
2052
|
-
if (
|
|
2053
|
-
if (!mergedConfig.platform) mergedConfig.platform = "neutral";
|
|
2054
|
+
if (isUndefined(mergedConfig.mode)) mergedConfig.mode = await this.getDefaultMode();
|
|
2055
|
+
if (isUndefined(mergedConfig.framework)) mergedConfig.framework = "powerlines";
|
|
2056
|
+
if (isUndefined(mergedConfig.platform)) mergedConfig.platform = "neutral";
|
|
2054
2057
|
mergedConfig.compatibilityDate = resolveCompatibilityDates(mergedConfig.compatibilityDate, "latest");
|
|
2058
|
+
if (!this.packageJson && existsSync(joinPaths(appendPath(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && existsSync(joinPaths(appendPath(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
|
|
2059
|
+
await this.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
|
|
2060
|
+
if (this.packageJson) mergedConfig.organization ??= getPackageJsonOrganization(this.packageJson) || "powerlines";
|
|
2061
|
+
}
|
|
2062
|
+
if (isUndefined(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
|
|
2055
2063
|
this.resolvedConfig = mergedConfig;
|
|
2056
2064
|
this.#configProxy = this.createConfigProxy();
|
|
2057
|
-
if (!this.packageJson) await this.resolvePackageConfigs();
|
|
2058
2065
|
mergedConfig.input = getUniqueInputs(mergedConfig.input);
|
|
2059
2066
|
if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
|
|
2060
2067
|
mergedConfig.title ??= titleCase(mergedConfig.name);
|
|
@@ -2065,18 +2072,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2065
2072
|
ret.push(plugin);
|
|
2066
2073
|
return ret;
|
|
2067
2074
|
}, []);
|
|
2068
|
-
if (
|
|
2075
|
+
if (isUndefined(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
|
|
2069
2076
|
else if (mergedConfig.mode === "test") mergedConfig.logLevel = DEFAULT_TEST_LOG_LEVEL;
|
|
2070
2077
|
else mergedConfig.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;
|
|
2071
2078
|
mergedConfig.logLevel = resolveLogLevel(mergedConfig.logLevel);
|
|
2072
|
-
if (mergedConfig.tsconfig) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
|
|
2079
|
+
if (isSetString(mergedConfig.tsconfig)) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
|
|
2073
2080
|
else mergedConfig.tsconfig = getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
|
|
2074
2081
|
mergedConfig.output.format = getUnique(toArray(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
|
|
2075
|
-
if (mergedConfig.output.path) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
|
|
2082
|
+
if (isSetString(mergedConfig.output.path)) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
|
|
2076
2083
|
else mergedConfig.output.path = appendPath(joinPaths(mergedConfig.root, "dist"), mergedConfig.cwd);
|
|
2077
2084
|
mergedConfig.output.copy ??= {};
|
|
2078
|
-
if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = mergedConfig.output.copy.path ? appendPath(replacePathTokens(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
|
|
2079
|
-
else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, mergedConfig.output.copy.path
|
|
2085
|
+
if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = isSetString(mergedConfig.output.copy.path) ? appendPath(replacePathTokens(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
|
|
2086
|
+
else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, isSetString(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : joinPaths("dist", mergedConfig.root)), mergedConfig.cwd);
|
|
2080
2087
|
if (mergedConfig.output.types !== false) mergedConfig.output.types = appendPath(replacePathTokens(this, mergedConfig.output.types || joinPaths(mergedConfig.root, `${mergedConfig.framework ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
|
|
2081
2088
|
if (mergedConfig.output.copy && mergedConfig.output.copy.path && mergedConfig.output.copy.assets && Array.isArray(mergedConfig.output.copy.assets)) mergedConfig.output.copy.assets = getUniqueBy(mergedConfig.output.copy.assets.map((asset) => {
|
|
2082
2089
|
return {
|
|
@@ -2086,11 +2093,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2086
2093
|
ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
|
|
2087
2094
|
};
|
|
2088
2095
|
}), (a) => `${a.input}-${a.glob}-${a.output}`);
|
|
2089
|
-
if (
|
|
2096
|
+
if (isUndefined(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
|
|
2090
2097
|
else mergedConfig.output.sourceMap = false;
|
|
2091
|
-
if (
|
|
2098
|
+
if (isUndefined(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
|
|
2092
2099
|
else mergedConfig.output.minify = false;
|
|
2093
|
-
if (
|
|
2100
|
+
if (isUndefined(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
|
|
2094
2101
|
if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
|
|
2095
2102
|
...asset,
|
|
2096
2103
|
glob: replacePathTokens(this, asset.glob),
|
|
@@ -2101,17 +2108,29 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2101
2108
|
if (isSetString(mergedConfig.output?.storage) && mergedConfig.output.storage === "virtual" || isSetObject(mergedConfig.output?.storage) && Object.values(mergedConfig.output.storage).every((adapter) => adapter.preset === "virtual")) mergedConfig.output.overwrite = true;
|
|
2102
2109
|
this.resolvedConfig = mergedConfig;
|
|
2103
2110
|
this.#configProxy = this.createConfigProxy();
|
|
2104
|
-
this.logger.
|
|
2111
|
+
this.logger.info({
|
|
2105
2112
|
meta: { category: "config" },
|
|
2106
|
-
message: `Resolved Powerlines configuration object: \n
|
|
2113
|
+
message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
|
|
2107
2114
|
});
|
|
2108
2115
|
this.#fs ??= await VirtualFileSystem.create(this);
|
|
2109
2116
|
}
|
|
2110
2117
|
logConfig(config) {
|
|
2111
|
-
return
|
|
2112
|
-
...omit(config, [
|
|
2113
|
-
|
|
2114
|
-
|
|
2118
|
+
return JSON.stringify(Object.fromEntries(Object.entries({
|
|
2119
|
+
...omit(config, [
|
|
2120
|
+
"plugins",
|
|
2121
|
+
"initialConfig",
|
|
2122
|
+
"userConfig",
|
|
2123
|
+
"inlineConfig",
|
|
2124
|
+
"pluginConfig",
|
|
2125
|
+
"environmentConfig"
|
|
2126
|
+
]),
|
|
2127
|
+
resolve: {
|
|
2128
|
+
...config.resolve,
|
|
2129
|
+
external: (config.resolve?.external ?? []).filter(Boolean).map((external) => isSetString(external) ? external : isRegExp(external) ? external.source : "<unknown-external>"),
|
|
2130
|
+
noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => isSetString(noExternal) ? noExternal : isRegExp(noExternal) ? noExternal.source : "<unknown-no-external>")
|
|
2131
|
+
},
|
|
2132
|
+
plugins: config.plugins ? config.plugins.flatMap((plugin) => toArray(plugin)).map((plugin) => String(isSetString(plugin) ? plugin : isSetObject(plugin) && isSetString(plugin.name) ? plugin.name : Array.isArray(plugin) && isSetString(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
|
|
2133
|
+
}).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,$/g, "");
|
|
2115
2134
|
}
|
|
2116
2135
|
createConfigProxy() {
|
|
2117
2136
|
return new Proxy(this.resolvedConfig, {
|
|
@@ -2138,6 +2157,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
|
|
|
2138
2157
|
if (key === "userConfig") return this.userConfig;
|
|
2139
2158
|
if (key === "inlineConfig") return this.inlineConfig;
|
|
2140
2159
|
if (key === "pluginConfig") return this.pluginConfig;
|
|
2160
|
+
if (key === "environmentConfig") return this.environmentConfig;
|
|
2141
2161
|
}
|
|
2142
2162
|
return Reflect.get(target, key, receiver);
|
|
2143
2163
|
},
|
|
@@ -2407,14 +2427,14 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
2407
2427
|
/**
|
|
2408
2428
|
* Create a new context from the config.
|
|
2409
2429
|
*
|
|
2410
|
-
* @param
|
|
2430
|
+
* @param initialOptions - The resolved execution options.
|
|
2411
2431
|
* @param config - The user configuration options.
|
|
2412
2432
|
* @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.
|
|
2413
2433
|
* @param environment - The resolved environment configuration, which may include additional properties or modifications made during the configuration loading process. This is used to provide context about the environment in which the command is being executed, allowing for environment-specific behavior and configuration resolution.
|
|
2414
2434
|
* @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.
|
|
2415
2435
|
*/
|
|
2416
|
-
static async createEnvironment(
|
|
2417
|
-
const context = new PowerlinesEnvironmentContext(
|
|
2436
|
+
static async createEnvironment(initialOptions, config, overriddenConfig, environment) {
|
|
2437
|
+
const context = new PowerlinesEnvironmentContext(initialOptions, config, overriddenConfig);
|
|
2418
2438
|
await context.setEnvironmentConfig(environment);
|
|
2419
2439
|
return context;
|
|
2420
2440
|
}
|
|
@@ -2467,7 +2487,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
2467
2487
|
* @returns A promise that resolves when the environment configuration values have been set.
|
|
2468
2488
|
*/
|
|
2469
2489
|
async setEnvironmentConfig(config) {
|
|
2470
|
-
this.logger.
|
|
2490
|
+
this.logger.debug({
|
|
2471
2491
|
meta: { category: "config" },
|
|
2472
2492
|
message: `Updating environment configuration object: \n${this.logConfig(config)}`
|
|
2473
2493
|
});
|
|
@@ -2682,7 +2702,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2682
2702
|
await super.setInlineConfig(config);
|
|
2683
2703
|
if (this.inlineConfig.command === "new") {
|
|
2684
2704
|
const workspacePackageJsonPath = joinPaths(this.config.cwd, "package.json");
|
|
2685
|
-
if (!existsSync(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
|
|
2705
|
+
if (!existsSync$1(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
|
|
2686
2706
|
this.packageJson = await readJsonFile(workspacePackageJsonPath);
|
|
2687
2707
|
}
|
|
2688
2708
|
}
|
|
@@ -2720,7 +2740,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2720
2740
|
* @returns A new context instance with the updated environment.
|
|
2721
2741
|
*/
|
|
2722
2742
|
async createEnvironment(environment) {
|
|
2723
|
-
const context = await PowerlinesEnvironmentContext.createEnvironment(deepClone(this.
|
|
2743
|
+
const context = await PowerlinesEnvironmentContext.createEnvironment(deepClone(this.initialOptions), deepClone(this.config), deepClone(this.overriddenConfig), deepClone(environment));
|
|
2724
2744
|
context.$$internal = this.$$internal;
|
|
2725
2745
|
context.dependencies = deepClone(this.dependencies);
|
|
2726
2746
|
context.devDependencies = deepClone(this.devDependencies);
|
|
@@ -2839,4 +2859,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
2839
2859
|
|
|
2840
2860
|
//#endregion
|
|
2841
2861
|
export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
|
|
2842
|
-
//# sourceMappingURL=execution-context-
|
|
2862
|
+
//# sourceMappingURL=execution-context-D-djno_x.mjs.map
|