@powerlines/engine 0.43.27 → 0.43.28

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.
@@ -2196,7 +2196,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
2196
2196
  return (0, _stryke_env_get_env_paths.getEnvPaths)({
2197
2197
  orgId: this.options.organization,
2198
2198
  appId: this.options.framework || "powerlines",
2199
- workspaceRoot: this.options.cwd || process.cwd() || "."
2199
+ workspaceRoot: this.options.cwd
2200
2200
  });
2201
2201
  }
2202
2202
  /**
@@ -2320,21 +2320,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
2320
2320
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
2321
2321
  this.powerlinesPath = powerlinesPath;
2322
2322
  }
2323
+ const cwd = options.cwd || this.options?.cwd || process.cwd();
2324
+ const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root) !== cwd ? options.root || this.options.root : "./";
2323
2325
  this.options = (0, defu.default)({
2324
- root: options.root,
2325
- cwd: options.cwd,
2326
+ root,
2327
+ cwd,
2326
2328
  mode: options.mode,
2327
2329
  framework: options.framework,
2328
2330
  organization: options.organization,
2329
2331
  configFile: options.configFile
2330
- }, this.options ?? {}, {
2331
- cwd: process.cwd() || ".",
2332
- mode: "production",
2333
- framework: "powerlines"
2334
- });
2332
+ }, this.options ?? {});
2335
2333
  this.resolver = createResolver({
2336
- workspaceRoot: this.options.cwd,
2337
- root: this.options.root,
2334
+ workspaceRoot: cwd,
2335
+ root,
2338
2336
  cacheDir: this.envPaths.cache,
2339
2337
  mode: this.options.mode,
2340
2338
  logLevel: this.logLevel
@@ -3083,6 +3081,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3083
3081
  * Initialize the context with the provided configuration options
3084
3082
  */
3085
3083
  async innerSetup() {
3084
+ if (!this.options.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
3085
+ this.options.mode = "production";
3086
+ this.config.mode = "production";
3087
+ }
3088
+ if (!this.options.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.pluginConfig?.framework) {
3089
+ this.options.framework = "powerlines";
3090
+ this.config.framework = "powerlines";
3091
+ }
3086
3092
  this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
3087
3093
  this.logger = {
3088
3094
  log: this.createLog(this.config.name),
@@ -3124,7 +3130,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3124
3130
  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);
3125
3131
  if (this.config.output.copy !== false) {
3126
3132
  this.config.output.copy ??= {};
3127
- 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);
3133
+ 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;
3134
+ 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);
3128
3135
  }
3129
3136
  if (this.config.output.dts !== false && this.config.output.types !== false) this.config.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.output.types || (0, _stryke_path_join.joinPaths)(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
3130
3137
  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) => {
@@ -2163,7 +2163,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
2163
2163
  return getEnvPaths({
2164
2164
  orgId: this.options.organization,
2165
2165
  appId: this.options.framework || "powerlines",
2166
- workspaceRoot: this.options.cwd || process.cwd() || "."
2166
+ workspaceRoot: this.options.cwd
2167
2167
  });
2168
2168
  }
2169
2169
  /**
@@ -2287,21 +2287,19 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
2287
2287
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
2288
2288
  this.powerlinesPath = powerlinesPath;
2289
2289
  }
2290
+ const cwd = options.cwd || this.options?.cwd || process.cwd();
2291
+ const root = (options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && (options.root || this.options.root) !== cwd ? options.root || this.options.root : "./";
2290
2292
  this.options = defu({
2291
- root: options.root,
2292
- cwd: options.cwd,
2293
+ root,
2294
+ cwd,
2293
2295
  mode: options.mode,
2294
2296
  framework: options.framework,
2295
2297
  organization: options.organization,
2296
2298
  configFile: options.configFile
2297
- }, this.options ?? {}, {
2298
- cwd: process.cwd() || ".",
2299
- mode: "production",
2300
- framework: "powerlines"
2301
- });
2299
+ }, this.options ?? {});
2302
2300
  this.resolver = createResolver({
2303
- workspaceRoot: this.options.cwd,
2304
- root: this.options.root,
2301
+ workspaceRoot: cwd,
2302
+ root,
2305
2303
  cacheDir: this.envPaths.cache,
2306
2304
  mode: this.options.mode,
2307
2305
  logLevel: this.logLevel
@@ -3050,6 +3048,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3050
3048
  * Initialize the context with the provided configuration options
3051
3049
  */
3052
3050
  async innerSetup() {
3051
+ if (!this.options.mode && !this.config.userConfig?.mode && !this.config.inlineConfig?.mode && !this.config.pluginConfig?.mode) {
3052
+ this.options.mode = "production";
3053
+ this.config.mode = "production";
3054
+ }
3055
+ if (!this.options.framework && !this.config.userConfig?.framework && !this.config.inlineConfig?.framework && !this.config.pluginConfig?.framework) {
3056
+ this.options.framework = "powerlines";
3057
+ this.config.framework = "powerlines";
3058
+ }
3053
3059
  this.resolvedConfig.compatibilityDate = resolveCompatibilityDates(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
3054
3060
  this.logger = {
3055
3061
  log: this.createLog(this.config.name),
@@ -3091,7 +3097,8 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3091
3097
  if (this.config.output.path) this.config.output.path = appendPath(replacePathTokens(this, this.config.output.path), this.config.cwd);
3092
3098
  if (this.config.output.copy !== false) {
3093
3099
  this.config.output.copy ??= {};
3094
- this.config.output.copy.path = appendPath(replacePathTokens(this, this.config.output.copy.path || joinPaths$1("dist", this.config.root)), this.config.cwd);
3100
+ 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;
3101
+ else this.config.output.copy.path = appendPath(replacePathTokens(this, this.config.output.copy.path || joinPaths$1("dist", this.config.root)), this.config.cwd);
3095
3102
  }
3096
3103
  if (this.config.output.dts !== false && this.config.output.types !== false) this.config.output.types = appendPath(replacePathTokens(this, this.config.output.types || joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`)), this.config.cwd);
3097
3104
  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) => {