@powerlines/engine 0.0.15 → 0.0.17

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.
@@ -14,6 +14,7 @@ import chalk from "chalk";
14
14
  import defu, { createDefu, defu as defu$1 } from "defu";
15
15
  import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
16
16
  import { titleCase } from "@stryke/string-format/title-case";
17
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
17
18
  import { format } from "@powerlines/core/lib/utilities/format";
18
19
  import { addPluginHook, dedupeHooklist, isDuplicate, isPlugin, isPluginConfig, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens } from "@powerlines/core/plugin-utils";
19
20
  import { toArray } from "@stryke/convert/to-array";
@@ -26,14 +27,13 @@ import { isParentPath } from "@stryke/path/is-parent-path";
26
27
  import { replaceExtension, replacePath } from "@stryke/path/replace";
27
28
  import { isFunction } from "@stryke/type-checks/is-function";
28
29
  import { isObject } from "@stryke/type-checks/is-object";
29
- import { isSetObject } from "@stryke/type-checks/is-set-object";
30
30
  import { isSetString } from "@stryke/type-checks/is-set-string";
31
31
  import { readJsonFile } from "@stryke/fs/json";
32
+ import { deepClone } from "@stryke/helpers/deep-clone";
32
33
  import { getUniqueInputs, isTypeDefinition, resolveInputsSync } from "@powerlines/core/lib/entry";
33
34
  import { relativeToWorkspaceRoot } from "@stryke/fs/get-workspace-root";
34
35
  import { murmurhash } from "@stryke/hash";
35
36
  import { hashDirectory } from "@stryke/hash/node";
36
- import { deepClone } from "@stryke/helpers/deep-clone";
37
37
  import { fetchRequest } from "@stryke/http/fetch";
38
38
  import { kebabCase } from "@stryke/string-format/kebab-case";
39
39
  import { uuid } from "@stryke/unique-id/uuid";
@@ -56,12 +56,12 @@ import { fileURLToPath } from "node:url";
56
56
  import { getField } from "@stryke/helpers/get-field";
57
57
 
58
58
  //#region src/_internal/helpers/environment.ts
59
- function createEnvironment(name, userConfig) {
60
- return defu(userConfig.environments?.[name] ?? {}, {
59
+ function createEnvironment(name, config = {}) {
60
+ return defu(config.environments?.[name] ?? {}, {
61
61
  name,
62
- title: userConfig.title || titleCase(userConfig.name),
62
+ title: config.title ?? titleCase(config.name),
63
63
  ssr: false,
64
- mainFields: userConfig?.platform === "browser" ? [
64
+ resolve: { mainFields: config.platform === "browser" ? [
65
65
  "browser",
66
66
  "module",
67
67
  "jsnext:main",
@@ -70,18 +70,9 @@ function createEnvironment(name, userConfig) {
70
70
  "module",
71
71
  "jsnext:main",
72
72
  "jsnext"
73
- ],
74
- extensions: [
75
- ".mjs",
76
- ".js",
77
- ".mts",
78
- ".ts",
79
- ".jsx",
80
- ".tsx",
81
- ".json"
82
- ],
83
- consumer: userConfig?.platform === "browser" ? "client" : "server",
84
- preview: userConfig?.platform === "browser" ? {
73
+ ] },
74
+ consumer: config.platform === "browser" ? "client" : "server",
75
+ preview: config.platform === "browser" ? {
85
76
  port: 5173,
86
77
  open: true,
87
78
  strictPort: false,
@@ -90,10 +81,37 @@ function createEnvironment(name, userConfig) {
90
81
  cors: true,
91
82
  headers: {}
92
83
  } : void 0
93
- }, userConfig);
84
+ });
94
85
  }
95
- function createDefaultEnvironment(userConfig) {
96
- return createEnvironment(DEFAULT_ENVIRONMENT, userConfig);
86
+ function createDefaultEnvironment(config = {}) {
87
+ return createEnvironment(DEFAULT_ENVIRONMENT, config);
88
+ }
89
+
90
+ //#endregion
91
+ //#region src/_internal/helpers/context.ts
92
+ function getConfigProps(config = {}, root, cwd) {
93
+ return {
94
+ name: config.name,
95
+ title: config.title,
96
+ description: config.description,
97
+ projectType: config.projectType,
98
+ customLogger: config.customLogger,
99
+ logLevel: config.logLevel,
100
+ tsconfig: config.tsconfig,
101
+ tsconfigRaw: config.tsconfigRaw,
102
+ skipCache: config.skipCache,
103
+ autoInstall: config.autoInstall,
104
+ input: isSetString(config.input) ? [config.input] : config.input,
105
+ plugins: config.plugins,
106
+ mode: config.mode,
107
+ resolve: config.resolve,
108
+ framework: config.framework,
109
+ ...config,
110
+ output: {
111
+ ...config.output ?? {},
112
+ path: config.output?.path ? appendPath(config.output.path, appendPath(root, cwd)) : void 0
113
+ }
114
+ };
97
115
  }
98
116
 
99
117
  //#endregion
@@ -1228,35 +1246,6 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1228
1246
  #tsconfig;
1229
1247
  #parserCache;
1230
1248
  #requestCache;
1231
- #getConfigProps(config = {}) {
1232
- return mergeConfig({
1233
- name: config.name,
1234
- title: config.title,
1235
- compatibilityDate: resolveCompatibilityDates(config.compatibilityDate, "latest"),
1236
- description: config.description,
1237
- projectType: config.projectType,
1238
- customLogger: config.customLogger,
1239
- logLevel: config.logLevel,
1240
- tsconfig: config.tsconfig,
1241
- tsconfigRaw: config.tsconfigRaw,
1242
- skipCache: config.skipCache,
1243
- autoInstall: config.autoInstall,
1244
- input: isSetString(config.input) ? [config.input] : config.input,
1245
- plugins: config.plugins,
1246
- mode: config.mode,
1247
- resolve: config.resolve,
1248
- framework: config.framework,
1249
- ...config,
1250
- output: {
1251
- ...config.output ?? {},
1252
- path: config.output?.path ? appendPath(config.output.path, appendPath(this.config.root, this.config.cwd)) : void 0
1253
- }
1254
- }, { output: config.framework ? {
1255
- artifactsPath: `.${config.framework ?? "powerlines"}`,
1256
- dts: true,
1257
- types: joinPaths(this.config.root, `${config.framework ?? "powerlines"}.d.ts`)
1258
- } : {} });
1259
- }
1260
1249
  /**
1261
1250
  * Create a new Storm context from the workspace root and user config.
1262
1251
  *
@@ -1871,36 +1860,16 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1871
1860
  }
1872
1861
  /**
1873
1862
  * Initialize the context with the provided configuration options
1874
- *
1875
- * @param config - The partial configuration options to initialize the context with
1876
1863
  */
1877
- async setup(config) {
1864
+ async setup() {
1878
1865
  this.resolvedConfig = mergeConfig({
1879
1866
  inlineConfig: this.config.inlineConfig ?? {},
1880
1867
  userConfig: this.config.userConfig ?? {},
1881
- pluginConfig: this.config.pluginConfig ?? {},
1882
- tsconfig: getTsconfigFilePath(this.options.cwd, this.options.root, config.tsconfig || this.config.tsconfig)
1883
- }, this.options, this.#getConfigProps(config), this.#getConfigProps(this.config), {
1868
+ pluginConfig: this.config.pluginConfig ?? {}
1869
+ }, this.options, this.config.inlineConfig ? getConfigProps(this.config.inlineConfig, this.options.root, this.options.cwd) : {}, this.config.userConfig ? getConfigProps(this.config.userConfig, this.options.root, this.options.cwd) : {}, this.config.pluginConfig ? getConfigProps(this.config.pluginConfig, this.options.root, this.options.cwd) : {}, {
1884
1870
  name: this.projectJson?.name || this.packageJson?.name,
1885
1871
  version: this.packageJson?.version,
1886
- description: this.packageJson?.description,
1887
- output: mergeConfig(this.config.output ?? {}, {
1888
- path: this.config.root ? appendPath(joinPaths(this.config.root, "dist"), this.config.cwd) : void 0,
1889
- copy: { assets: [
1890
- { glob: "LICENSE" },
1891
- {
1892
- input: this.config.root,
1893
- glob: "*.md"
1894
- },
1895
- {
1896
- input: this.config.root,
1897
- glob: "package.json"
1898
- }
1899
- ] },
1900
- artifactsPath: `.${this.config.framework ?? "powerlines"}`,
1901
- dts: true,
1902
- types: joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)
1903
- })
1872
+ description: this.packageJson?.description
1904
1873
  }, {
1905
1874
  projectType: "application",
1906
1875
  platform: "neutral",
@@ -1909,6 +1878,78 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1909
1878
  environments: {},
1910
1879
  resolve: {}
1911
1880
  });
1881
+ await this.innerSetup();
1882
+ }
1883
+ /**
1884
+ * The resolved configuration for this context
1885
+ */
1886
+ resolvedConfig = {};
1887
+ /**
1888
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
1889
+ *
1890
+ * @remarks
1891
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
1892
+ *
1893
+ * @returns The cloned context.
1894
+ */
1895
+ copyTo(context) {
1896
+ context.dependencies = deepClone(this.dependencies);
1897
+ context.devDependencies = deepClone(this.devDependencies);
1898
+ context.persistedMeta = this.persistedMeta ? deepClone(this.persistedMeta) : void 0;
1899
+ context.packageJson = deepClone(this.packageJson);
1900
+ context.projectJson = this.projectJson ? deepClone(this.projectJson) : void 0;
1901
+ context.tsconfig = deepClone(this.tsconfig);
1902
+ context.$$internal = this.$$internal;
1903
+ return context;
1904
+ }
1905
+ /**
1906
+ * Initialize the context with the provided configuration options
1907
+ *
1908
+ * @remarks
1909
+ * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
1910
+ *
1911
+ * @param options - The configuration options to initialize the context with
1912
+ */
1913
+ async init(options = {}) {
1914
+ await super.init(options);
1915
+ this.options.configIndex = options.configIndex ?? this.options.configIndex ?? 0;
1916
+ const projectJsonPath = joinPaths(this.options.root, "project.json");
1917
+ if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
1918
+ const packageJsonPath = joinPaths(this.options.root, "package.json");
1919
+ if (existsSync(packageJsonPath)) {
1920
+ this.packageJson = await readJsonFile(packageJsonPath);
1921
+ this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
1922
+ }
1923
+ this.#checksum = await this.generateChecksum(this.options.root);
1924
+ const userConfig = this.configFile.config ? Array.isArray(this.configFile.config) && this.configFile.config.length > this.options.configIndex ? this.configFile.config[this.options.configIndex] : this.configFile.config : {};
1925
+ this.resolvedConfig = {
1926
+ ...this.options,
1927
+ ...userConfig,
1928
+ userConfig
1929
+ };
1930
+ }
1931
+ /**
1932
+ * Initialize the context with the provided configuration options
1933
+ */
1934
+ async innerSetup() {
1935
+ this.resolvedConfig.compatibilityDate = resolveCompatibilityDates(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
1936
+ this.resolvedConfig.output = defu(this.resolvedConfig.output ?? {}, {
1937
+ path: this.config.root ? appendPath(joinPaths(this.config.root, "dist"), this.config.cwd) : void 0,
1938
+ copy: { assets: [
1939
+ { glob: "LICENSE" },
1940
+ {
1941
+ input: this.config.root,
1942
+ glob: "*.md"
1943
+ },
1944
+ {
1945
+ input: this.config.root,
1946
+ glob: "package.json"
1947
+ }
1948
+ ] },
1949
+ artifactsPath: `.${this.config.framework ?? "powerlines"}`,
1950
+ dts: true,
1951
+ types: joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)
1952
+ });
1912
1953
  this.logger = {
1913
1954
  log: this.createLog(this.config.name),
1914
1955
  level: isNull(this.logLevel) ? "silent" : this.logLevel
@@ -1946,7 +1987,6 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1946
1987
  ret.push(plugin);
1947
1988
  return ret;
1948
1989
  }, []);
1949
- if (this.config.tsconfig) this.config.tsconfig = replacePathTokens(this, this.config.tsconfig);
1950
1990
  if (this.config.output.types) if (isSetString(this.config.output.types)) this.config.output.types = replacePathTokens(this, this.config.output.types);
1951
1991
  else this.config.output.types = joinPaths(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
1952
1992
  if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = "debug";
@@ -1955,6 +1995,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1955
1995
  else this.config.output.sourceMap = false;
1956
1996
  if (!this.config.userConfig?.output?.minify && !this.config.inlineConfig?.output?.minify) if (this.config.mode === "production") this.config.output.minify = true;
1957
1997
  else this.config.output.minify = false;
1998
+ if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = getTsconfigFilePath(this.options.cwd, this.options.root);
1999
+ else if (this.config.tsconfig) this.config.tsconfig = replacePath(replacePathTokens(this, this.config.tsconfig), this.config.cwd);
1958
2000
  if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
1959
2001
  ...asset,
1960
2002
  glob: replacePathTokens(this, asset.glob),
@@ -1965,54 +2007,6 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
1965
2007
  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;
1966
2008
  this.#fs ??= await VirtualFileSystem.create(this);
1967
2009
  }
1968
- /**
1969
- * The resolved configuration for this context
1970
- */
1971
- resolvedConfig = {};
1972
- /**
1973
- * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
1974
- *
1975
- * @remarks
1976
- * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
1977
- *
1978
- * @returns The cloned context.
1979
- */
1980
- copyTo(context) {
1981
- context.dependencies = deepClone(this.dependencies);
1982
- context.devDependencies = deepClone(this.devDependencies);
1983
- context.persistedMeta = this.persistedMeta ? deepClone(this.persistedMeta) : void 0;
1984
- context.packageJson = deepClone(this.packageJson);
1985
- context.projectJson = this.projectJson ? deepClone(this.projectJson) : void 0;
1986
- context.tsconfig = deepClone(this.tsconfig);
1987
- context.$$internal = this.$$internal;
1988
- return context;
1989
- }
1990
- /**
1991
- * Initialize the context with the provided configuration options
1992
- *
1993
- * @remarks
1994
- * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
1995
- *
1996
- * @param options - The configuration options to initialize the context with
1997
- */
1998
- async init(options = {}) {
1999
- await super.init(options);
2000
- this.options.configIndex = options.configIndex ?? this.options.configIndex ?? 0;
2001
- const projectJsonPath = joinPaths(this.options.root, "project.json");
2002
- if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
2003
- const packageJsonPath = joinPaths(this.options.root, "package.json");
2004
- if (existsSync(packageJsonPath)) {
2005
- this.packageJson = await readJsonFile(packageJsonPath);
2006
- this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
2007
- }
2008
- this.#checksum = await this.generateChecksum(this.options.root);
2009
- const userConfig = this.configFile.config ? Array.isArray(this.configFile.config) && this.configFile.config.length > this.options.configIndex ? this.configFile.config[this.options.configIndex] : this.configFile.config : {};
2010
- this.resolvedConfig = {
2011
- ...this.options,
2012
- ...userConfig,
2013
- userConfig
2014
- };
2015
- }
2016
2010
  };
2017
2011
 
2018
2012
  //#endregion
@@ -2236,10 +2230,9 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2236
2230
  * @param config - The user configuration options.
2237
2231
  * @returns A promise that resolves to the new context.
2238
2232
  */
2239
- static async fromConfig(options, config) {
2240
- const context = new PowerlinesEnvironmentContext(options, config);
2241
- await context.init(options);
2242
- await context.setup(config);
2233
+ static async fromConfig(options, config, environment) {
2234
+ const context = new PowerlinesEnvironmentContext(options, config, environment);
2235
+ await context.setup();
2243
2236
  const powerlinesPath = await resolvePackage("powerlines");
2244
2237
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
2245
2238
  context.powerlinesPath = powerlinesPath;
@@ -2281,9 +2274,19 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2281
2274
  * @returns A promise that resolves to the cloned context.
2282
2275
  */
2283
2276
  async clone() {
2284
- const context = await PowerlinesEnvironmentContext.fromConfig(this.options, this.config);
2277
+ const context = await PowerlinesEnvironmentContext.fromConfig(deepClone(this.options), deepClone(this.config), deepClone(this.environment));
2285
2278
  return this.copyTo(context);
2286
2279
  }
2280
+ /**
2281
+ * Initialize the context with the provided configuration options
2282
+ */
2283
+ async setup() {
2284
+ this.resolvedConfig = mergeConfig({
2285
+ name: this.config.name,
2286
+ title: this.config.title
2287
+ }, getConfigProps(this.environment, this.options.root, this.options.cwd), this.config);
2288
+ await this.innerSetup();
2289
+ }
2287
2290
  async addPlugin(plugin) {
2288
2291
  let resolvedPlugin = plugin;
2289
2292
  if (isFunction(plugin.applyToEnvironment)) {
@@ -2336,9 +2339,10 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2336
2339
  }
2337
2340
  return result;
2338
2341
  }
2339
- constructor(options, config) {
2342
+ constructor(options, config, environment) {
2340
2343
  super(options);
2341
2344
  this.resolvedConfig = config;
2345
+ this.environment = environment;
2342
2346
  }
2343
2347
  /**
2344
2348
  * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
@@ -2388,7 +2392,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2388
2392
  if (!existsSync(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
2389
2393
  context.packageJson = await readJsonFile(workspacePackageJsonPath);
2390
2394
  }
2391
- await context.setup(config);
2395
+ await context.setup();
2392
2396
  const powerlinesPath = await resolvePackage("powerlines");
2393
2397
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
2394
2398
  context.powerlinesPath = powerlinesPath;
@@ -2444,48 +2448,32 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2444
2448
  */
2445
2449
  async clone() {
2446
2450
  const clone = await PowerlinesExecutionContext.fromOptions(this.options);
2447
- clone.config.userConfig = this.config.userConfig;
2448
- await clone.setup(this.config.inlineConfig);
2451
+ clone.config.userConfig = deepClone(this.config.userConfig);
2452
+ clone.config.inlineConfig = deepClone(this.config.inlineConfig);
2453
+ clone.config.pluginConfig = deepClone(this.config.pluginConfig);
2454
+ await clone.setup();
2455
+ clone.$$internal = this.$$internal;
2449
2456
  return this.copyTo(clone);
2450
2457
  }
2451
2458
  /**
2452
- * Initialize the context with the provided configuration options
2453
- *
2454
- * @param options - The resolved execution options to use for initialization.
2455
- */
2456
- async init(options) {
2457
- await super.init(options);
2458
- await Promise.all(toArray(this.config.environments && Object.keys(this.config.environments).length > 0 ? Object.keys(this.config.environments).map((name) => createEnvironment(name, this.config)) : createDefaultEnvironment(this.config)).map(async (env) => {
2459
- this.#environments[env.name] = await this.in(env);
2460
- }));
2461
- }
2462
- /**
2463
2459
  * A function to copy the context and update the fields for a specific environment
2464
2460
  *
2465
2461
  * @param environment - The environment configuration to use.
2466
2462
  * @returns A new context instance with the updated environment.
2467
2463
  */
2468
2464
  async in(environment) {
2469
- let context;
2470
- if (this.environments[environment.name]) context = this.environments[environment.name];
2471
- else context = await PowerlinesEnvironmentContext.fromConfig(this.options, this.config);
2472
- if (isSetObject(this.config.inlineConfig)) await context.setup(this.config.inlineConfig);
2473
- context.environment = environment;
2465
+ const context = this.copyTo(await PowerlinesEnvironmentContext.fromConfig(deepClone(this.options), deepClone(this.config), deepClone(environment)));
2474
2466
  context.plugins = [];
2475
2467
  for (const plugin of this.plugins) await context.addPlugin(plugin);
2476
2468
  return context;
2477
2469
  }
2478
2470
  /**
2479
2471
  * Update the context using a new inline configuration options
2480
- *
2481
- * @param config - The new inline configuration options.
2482
2472
  */
2483
- async setup(config) {
2484
- await super.setup(config);
2473
+ async setup() {
2474
+ await super.setup();
2485
2475
  await Promise.all(toArray(this.config.environments && Object.keys(this.config.environments).length > 0 ? Object.keys(this.config.environments).map((name) => createEnvironment(name, this.config)) : createDefaultEnvironment(this.config)).map(async (env) => {
2486
- const context = await this.in(env);
2487
- await context.setup(config);
2488
- this.#environments[env.name] = context;
2476
+ this.#environments[env.name] = await this.in(env);
2489
2477
  }));
2490
2478
  }
2491
2479
  /**
@@ -2514,7 +2502,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2514
2502
  }
2515
2503
  if (!environment) {
2516
2504
  if (name) throw new Error(`Environment "${name}" not found.`);
2517
- environment = await this.in(createDefaultEnvironment(this.config.userConfig));
2505
+ environment = await this.in(createDefaultEnvironment(this.config));
2518
2506
  this.warn(`No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(environment?.environment.name)}`);
2519
2507
  }
2520
2508
  return environment;
@@ -2543,7 +2531,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2543
2531
  async toEnvironment() {
2544
2532
  let environment;
2545
2533
  if (Object.keys(this.environments).length > 1) {
2546
- environment = await this.in(createEnvironment(GLOBAL_ENVIRONMENT, this.config.userConfig));
2534
+ environment = await this.in(createEnvironment(GLOBAL_ENVIRONMENT, this.config));
2547
2535
  this.debug(`Combined all ${Object.keys(this.environments).length} environments into a single global context.`);
2548
2536
  } else environment = await this.getEnvironment();
2549
2537
  return environment;
@@ -2552,4 +2540,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2552
2540
 
2553
2541
  //#endregion
2554
2542
  export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
2555
- //# sourceMappingURL=execution-context-DaplwLr4.mjs.map
2543
+ //# sourceMappingURL=execution-context-B5Ijc574.mjs.map