@powerlines/engine 0.46.0 → 0.46.2

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.
Files changed (33) hide show
  1. package/dist/_internal/worker.cjs +63 -25
  2. package/dist/_internal/worker.mjs +63 -25
  3. package/dist/_internal/worker.mjs.map +1 -1
  4. package/dist/api.cjs +1 -1
  5. package/dist/api.d.cts +1 -1
  6. package/dist/api.d.cts.map +1 -1
  7. package/dist/api.d.mts +1 -1
  8. package/dist/api.d.mts.map +1 -1
  9. package/dist/api.mjs +1 -1
  10. package/dist/api.mjs.map +1 -1
  11. package/dist/{base-context-BCG0xN2e.cjs → base-context-D7G_24-i.cjs} +21 -21
  12. package/dist/{base-context-Cmo6TTh7.mjs → base-context-DU0NRHDt.mjs} +22 -22
  13. package/dist/base-context-DU0NRHDt.mjs.map +1 -0
  14. package/dist/context/index.cjs +3 -3
  15. package/dist/context/index.d.cts +1 -1
  16. package/dist/context/index.d.mts +1 -1
  17. package/dist/context/index.mjs +3 -3
  18. package/dist/{engine-context-DOsGtgD9.cjs → engine-context-BuJQY312.cjs} +1 -1
  19. package/dist/{engine-context-BjFMVQEE.mjs → engine-context-BvDfqfY7.mjs} +2 -2
  20. package/dist/{engine-context-BjFMVQEE.mjs.map → engine-context-BvDfqfY7.mjs.map} +1 -1
  21. package/dist/{execution-context-BdZt7wWa.d.mts → execution-context-BpRfsnkE.d.mts} +23 -10
  22. package/dist/execution-context-BpRfsnkE.d.mts.map +1 -0
  23. package/dist/{execution-context-CU6iNchD.d.cts → execution-context-CodQucFX.d.cts} +23 -10
  24. package/dist/execution-context-CodQucFX.d.cts.map +1 -0
  25. package/dist/{execution-context-DgqxcDDx.cjs → execution-context-Uid7ycTD.cjs} +43 -5
  26. package/dist/{execution-context-Cp32TarF.mjs → execution-context-pt2zvro6.mjs} +44 -6
  27. package/dist/{execution-context-Cp32TarF.mjs.map → execution-context-pt2zvro6.mjs.map} +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.mjs +1 -1
  30. package/package.json +3 -3
  31. package/dist/base-context-Cmo6TTh7.mjs.map +0 -1
  32. package/dist/execution-context-BdZt7wWa.d.mts.map +0 -1
  33. package/dist/execution-context-CU6iNchD.d.cts.map +0 -1
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesBaseContext } from "./base-context-Cmo6TTh7.mjs";
1
+ import { t as PowerlinesBaseContext } from "./base-context-DU0NRHDt.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";
@@ -2007,6 +2007,19 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2007
2007
  else await this.setUserConfig(isFunction(result) ? await Promise.resolve(result(this.options)) : result);
2008
2008
  }
2009
2009
  /**
2010
+ * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.
2011
+ *
2012
+ * @remarks
2013
+ * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.
2014
+ *
2015
+ * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.
2016
+ * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.
2017
+ * @returns A promise that resolves when the package configurations have been loaded and stored in the context.
2018
+ */
2019
+ async resolvePackageConfigs(cwd = this.config.cwd, root = this.config.root) {
2020
+ return super.resolvePackageConfigs(cwd, root);
2021
+ }
2022
+ /**
2010
2023
  * Initialize the context with the provided configuration options
2011
2024
  */
2012
2025
  async resolveConfig() {
@@ -2036,6 +2049,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2036
2049
  mergedConfig.compatibilityDate = resolveCompatibilityDates(mergedConfig.compatibilityDate, "latest");
2037
2050
  this.resolvedConfig = mergedConfig;
2038
2051
  this.#configProxy = this.createConfigProxy();
2052
+ if (!this.packageJson) await this.resolvePackageConfigs();
2039
2053
  mergedConfig.input = getUniqueInputs(mergedConfig.input);
2040
2054
  if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
2041
2055
  mergedConfig.title ??= titleCase(mergedConfig.name);
@@ -2487,10 +2501,10 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2487
2501
  if (isPluginConfig(result)) return this.$$internal.addPlugin(result);
2488
2502
  resolvedPlugin = isPlugin(result) ? result : plugin;
2489
2503
  }
2490
- const pluginId = uuid();
2491
- const context = createPluginContext(pluginId, resolvedPlugin, this);
2504
+ const id = uuid();
2505
+ const context = createPluginContext(id, resolvedPlugin, this);
2492
2506
  this.plugins.push({
2493
- pluginId,
2507
+ id,
2494
2508
  plugin: resolvedPlugin,
2495
2509
  context
2496
2510
  });
@@ -2548,6 +2562,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2548
2562
  mergeConfig() {
2549
2563
  return mergeConfig({
2550
2564
  ...omit(this.environmentConfig ?? {}, [
2565
+ "name",
2551
2566
  "ssr",
2552
2567
  "preview",
2553
2568
  "consumer",
@@ -2700,15 +2715,38 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2700
2715
  */
2701
2716
  async createEnvironment(environment) {
2702
2717
  const context = await PowerlinesEnvironmentContext.createEnvironment(deepClone(this.options), deepClone(this.config), deepClone(this.overriddenConfig), deepClone(environment));
2718
+ context.$$internal = this.$$internal;
2703
2719
  context.dependencies = deepClone(this.dependencies);
2704
2720
  context.devDependencies = deepClone(this.devDependencies);
2705
2721
  context.persistedMeta = deepClone(this.persistedMeta);
2706
2722
  context.resolvePatterns = deepClone(this.resolvePatterns);
2707
2723
  context.powerlinesPath ??= this.powerlinesPath;
2708
2724
  context.resolver ??= this.resolver;
2709
- context.$$internal = this.$$internal;
2710
2725
  context.plugins = [];
2711
2726
  for (const plugin of this.plugins) await context.addPlugin(plugin);
2727
+ for (const [key, value] of Object.entries(this)) if (![
2728
+ "fs",
2729
+ "$$internal",
2730
+ "initialOptions",
2731
+ "options",
2732
+ "config",
2733
+ "initialConfig",
2734
+ "inlineConfig",
2735
+ "userConfig",
2736
+ "pluginConfig",
2737
+ "overriddenConfig",
2738
+ "environmentConfig",
2739
+ "dependencies",
2740
+ "devDependencies",
2741
+ "persistedMeta",
2742
+ "packageJson",
2743
+ "projectJson",
2744
+ "tsconfig",
2745
+ "resolver",
2746
+ "plugins",
2747
+ "environments"
2748
+ ].includes(key)) if (isObject(value) || Array.isArray(value)) context[key] = deepClone(value);
2749
+ else context[key] = value;
2712
2750
  return context;
2713
2751
  }
2714
2752
  /**
@@ -2795,4 +2833,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2795
2833
 
2796
2834
  //#endregion
2797
2835
  export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
2798
- //# sourceMappingURL=execution-context-Cp32TarF.mjs.map
2836
+ //# sourceMappingURL=execution-context-pt2zvro6.mjs.map