@powerlines/plugin-automd 0.1.8 → 0.1.10

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.
@@ -29,6 +29,73 @@ interface BuildConfig {
29
29
  * @defaultValue "neutral"
30
30
  */
31
31
  platform?: "node" | "browser" | "neutral";
32
+ /**
33
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
34
+ *
35
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
36
+ */
37
+ mainFields?: string[];
38
+ /**
39
+ * Array of strings indicating what conditions should be used for module resolution.
40
+ */
41
+ conditions?: string[];
42
+ /**
43
+ * Array of strings indicating what file extensions should be used for module resolution.
44
+ *
45
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
46
+ */
47
+ extensions?: string[];
48
+ /**
49
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
50
+ *
51
+ * @remarks
52
+ * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
53
+ */
54
+ dedupe?: string[];
55
+ /**
56
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
57
+ */
58
+ builtins?: (string | RegExp)[];
59
+ /**
60
+ * Define global variable replacements.
61
+ *
62
+ * @remarks
63
+ * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * {
68
+ * define: {
69
+ * __VERSION__: '"1.0.0"',
70
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
71
+ * }
72
+ * }
73
+ * ```
74
+ *
75
+ * @see https://esbuild.github.io/api/#define
76
+ * @see https://vitejs.dev/config/build-options.html#define
77
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
78
+ */
79
+ define?: Record<string, any>;
80
+ /**
81
+ * Global variables that will have import statements injected where necessary
82
+ *
83
+ * @remarks
84
+ * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * {
89
+ * inject: {
90
+ * process: 'process/browser',
91
+ * Buffer: ['buffer', 'Buffer'],
92
+ * }
93
+ * }
94
+ * ```
95
+ *
96
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
97
+ */
98
+ inject?: Record<string, string | string[]>;
32
99
  /**
33
100
  * The alias mappings to use for module resolution during the build process.
34
101
  *
@@ -44,6 +111,8 @@ interface BuildConfig {
44
111
  * }
45
112
  * }
46
113
  * ```
114
+ *
115
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
47
116
  */
48
117
  alias?: Record<string, string>;
49
118
  /**
@@ -62,13 +131,14 @@ interface BuildConfig {
62
131
  */
63
132
  skipNodeModulesBundle?: boolean;
64
133
  /**
65
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
134
+ * An optional set of override options to apply to the selected build variant.
66
135
  *
67
- * @defaultValue false
136
+ * @remarks
137
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
68
138
  */
69
- skipPrepare?: boolean;
139
+ override?: Record<string, any>;
70
140
  }
71
- type BuildResolvedConfig = BuildConfig;
141
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
72
142
 
73
143
  type ReflectionMode = "default" | "explicit" | "never";
74
144
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -644,24 +714,33 @@ interface BaseConfig {
644
714
  * The entry point(s) for the application
645
715
  */
646
716
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
717
+ /**
718
+ * Configuration for the output of the build process
719
+ */
720
+ output?: OutputConfig;
647
721
  /**
648
722
  * Configuration for linting the source code
723
+ *
724
+ * @remarks
725
+ * If set to `false`, linting will be disabled.
649
726
  */
650
727
  lint?: Record<string, any> | false;
651
728
  /**
652
729
  * Configuration for testing the source code
730
+ *
731
+ * @remarks
732
+ * If set to `false`, testing will be disabled.
653
733
  */
654
734
  test?: Record<string, any> | false;
655
- /**
656
- * Configuration for the output of the build process
657
- */
658
- output?: OutputConfig;
659
735
  /**
660
736
  * Configuration for the transformation of the source code
661
737
  */
662
738
  transform?: Record<string, any>;
663
739
  /**
664
- * Options to to provide to the build process
740
+ * Configuration provided to build processes
741
+ *
742
+ * @remarks
743
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
665
744
  */
666
745
  build?: BuildConfig;
667
746
  /**
@@ -691,37 +770,6 @@ interface BaseConfig {
691
770
  tsconfigRaw?: TSConfig;
692
771
  }
693
772
  interface EnvironmentConfig extends BaseConfig {
694
- /**
695
- * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
696
- *
697
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
698
- */
699
- mainFields?: string[];
700
- /**
701
- * Array of strings indicating what conditions should be used for module resolution.
702
- */
703
- conditions?: string[];
704
- /**
705
- * Array of strings indicating what conditions should be used for external modules.
706
- */
707
- externalConditions?: string[];
708
- /**
709
- * Array of strings indicating what file extensions should be used for module resolution.
710
- *
711
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
712
- */
713
- extensions?: string[];
714
- /**
715
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
716
- *
717
- * @remarks
718
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
719
- */
720
- dedupe?: string[];
721
- /**
722
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
723
- */
724
- builtins?: (string | RegExp)[];
725
773
  /**
726
774
  * Configuration options for the preview server
727
775
  */
@@ -794,14 +842,26 @@ interface CommonUserConfig extends BaseConfig {
794
842
  */
795
843
  framework?: string;
796
844
  }
797
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
798
- build?: TBuildConfig & {
845
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
846
+ /**
847
+ * Configuration provided to build processes
848
+ *
849
+ * @remarks
850
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
851
+ */
852
+ build: Omit<TBuildConfig, "override"> & {
799
853
  /**
800
854
  * The build variant being used by the Powerlines engine.
801
855
  */
802
856
  variant?: TBuildVariant;
857
+ /**
858
+ * An optional set of override options to apply to the selected build variant.
859
+ *
860
+ * @remarks
861
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
862
+ */
863
+ override?: Partial<TBuildResolvedConfig>;
803
864
  };
804
- override?: Partial<TBuildResolvedConfig>;
805
865
  };
806
866
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
807
867
  /**
@@ -824,7 +884,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
824
884
  */
825
885
  output?: string;
826
886
  }
827
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
887
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
828
888
  /**
829
889
  * The name of the environment
830
890
  */
@@ -841,7 +901,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
841
901
  /**
842
902
  * The resolved options for the Powerlines project configuration.
843
903
  */
844
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "framework">> & {
904
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
845
905
  /**
846
906
  * The configuration options that were provided inline to the Powerlines CLI.
847
907
  */
@@ -872,6 +932,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
872
932
  * The output configuration options to use for the build process
873
933
  */
874
934
  output: OutputResolvedConfig;
935
+ /**
936
+ * Configuration provided to build processes
937
+ *
938
+ * @remarks
939
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
940
+ */
941
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
875
942
  /**
876
943
  * The log level to use for the Powerlines processes.
877
944
  *
@@ -925,7 +992,13 @@ interface InitContextOptions {
925
992
  */
926
993
  isHighPriority: boolean;
927
994
  }
928
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
995
+ /**
996
+ * The unresolved Powerlines context.
997
+ *
998
+ * @remarks
999
+ * This context is used before the user configuration has been fully resolved after the `config`.
1000
+ */
1001
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
929
1002
  /**
930
1003
  * The Storm workspace configuration
931
1004
  */
@@ -933,7 +1006,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
933
1006
  /**
934
1007
  * An object containing the options provided to Powerlines
935
1008
  */
936
- config: TResolvedConfig;
1009
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1010
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1011
+ output: TResolvedConfig["output"];
1012
+ };
937
1013
  /**
938
1014
  * A logging function for the Powerlines engine
939
1015
  */
@@ -1090,6 +1166,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1090
1166
  */
1091
1167
  extendLog: (name: string) => LogFn;
1092
1168
  }
1169
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1170
+ /**
1171
+ * The fully resolved Powerlines configuration
1172
+ */
1173
+ config: TResolvedConfig;
1174
+ };
1093
1175
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1094
1176
  /**
1095
1177
  * The environment specific resolved configuration
@@ -1130,6 +1212,10 @@ interface GenerateTypesResult {
1130
1212
  directives?: string[];
1131
1213
  code: string;
1132
1214
  }
1215
+ type DeepPartial<T> = {
1216
+ [K in keyof T]?: DeepPartial<T[K]>;
1217
+ };
1218
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1133
1219
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1134
1220
  /**
1135
1221
  * A function that returns configuration options to be merged with the build context's options.
@@ -1145,7 +1231,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1145
1231
  * @param config - The partial configuration object to be modified.
1146
1232
  * @returns A promise that resolves to a partial configuration object.
1147
1233
  */
1148
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1234
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1149
1235
  /**
1150
1236
  * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
1151
1237
  *
@@ -1248,7 +1334,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1248
1334
  * @param config - The partial configuration object to be modified.
1249
1335
  * @returns A promise that resolves to a partial configuration object.
1250
1336
  */
1251
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1337
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1252
1338
  /**
1253
1339
  * A hook that is called to transform the source code.
1254
1340
  *
@@ -29,6 +29,73 @@ interface BuildConfig {
29
29
  * @defaultValue "neutral"
30
30
  */
31
31
  platform?: "node" | "browser" | "neutral";
32
+ /**
33
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
34
+ *
35
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
36
+ */
37
+ mainFields?: string[];
38
+ /**
39
+ * Array of strings indicating what conditions should be used for module resolution.
40
+ */
41
+ conditions?: string[];
42
+ /**
43
+ * Array of strings indicating what file extensions should be used for module resolution.
44
+ *
45
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
46
+ */
47
+ extensions?: string[];
48
+ /**
49
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
50
+ *
51
+ * @remarks
52
+ * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
53
+ */
54
+ dedupe?: string[];
55
+ /**
56
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
57
+ */
58
+ builtins?: (string | RegExp)[];
59
+ /**
60
+ * Define global variable replacements.
61
+ *
62
+ * @remarks
63
+ * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * {
68
+ * define: {
69
+ * __VERSION__: '"1.0.0"',
70
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
71
+ * }
72
+ * }
73
+ * ```
74
+ *
75
+ * @see https://esbuild.github.io/api/#define
76
+ * @see https://vitejs.dev/config/build-options.html#define
77
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
78
+ */
79
+ define?: Record<string, any>;
80
+ /**
81
+ * Global variables that will have import statements injected where necessary
82
+ *
83
+ * @remarks
84
+ * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * {
89
+ * inject: {
90
+ * process: 'process/browser',
91
+ * Buffer: ['buffer', 'Buffer'],
92
+ * }
93
+ * }
94
+ * ```
95
+ *
96
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
97
+ */
98
+ inject?: Record<string, string | string[]>;
32
99
  /**
33
100
  * The alias mappings to use for module resolution during the build process.
34
101
  *
@@ -44,6 +111,8 @@ interface BuildConfig {
44
111
  * }
45
112
  * }
46
113
  * ```
114
+ *
115
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
47
116
  */
48
117
  alias?: Record<string, string>;
49
118
  /**
@@ -62,13 +131,14 @@ interface BuildConfig {
62
131
  */
63
132
  skipNodeModulesBundle?: boolean;
64
133
  /**
65
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
134
+ * An optional set of override options to apply to the selected build variant.
66
135
  *
67
- * @defaultValue false
136
+ * @remarks
137
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
68
138
  */
69
- skipPrepare?: boolean;
139
+ override?: Record<string, any>;
70
140
  }
71
- type BuildResolvedConfig = BuildConfig;
141
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
72
142
 
73
143
  type ReflectionMode = "default" | "explicit" | "never";
74
144
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -644,24 +714,33 @@ interface BaseConfig {
644
714
  * The entry point(s) for the application
645
715
  */
646
716
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
717
+ /**
718
+ * Configuration for the output of the build process
719
+ */
720
+ output?: OutputConfig;
647
721
  /**
648
722
  * Configuration for linting the source code
723
+ *
724
+ * @remarks
725
+ * If set to `false`, linting will be disabled.
649
726
  */
650
727
  lint?: Record<string, any> | false;
651
728
  /**
652
729
  * Configuration for testing the source code
730
+ *
731
+ * @remarks
732
+ * If set to `false`, testing will be disabled.
653
733
  */
654
734
  test?: Record<string, any> | false;
655
- /**
656
- * Configuration for the output of the build process
657
- */
658
- output?: OutputConfig;
659
735
  /**
660
736
  * Configuration for the transformation of the source code
661
737
  */
662
738
  transform?: Record<string, any>;
663
739
  /**
664
- * Options to to provide to the build process
740
+ * Configuration provided to build processes
741
+ *
742
+ * @remarks
743
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
665
744
  */
666
745
  build?: BuildConfig;
667
746
  /**
@@ -691,37 +770,6 @@ interface BaseConfig {
691
770
  tsconfigRaw?: TSConfig;
692
771
  }
693
772
  interface EnvironmentConfig extends BaseConfig {
694
- /**
695
- * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
696
- *
697
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
698
- */
699
- mainFields?: string[];
700
- /**
701
- * Array of strings indicating what conditions should be used for module resolution.
702
- */
703
- conditions?: string[];
704
- /**
705
- * Array of strings indicating what conditions should be used for external modules.
706
- */
707
- externalConditions?: string[];
708
- /**
709
- * Array of strings indicating what file extensions should be used for module resolution.
710
- *
711
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
712
- */
713
- extensions?: string[];
714
- /**
715
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
716
- *
717
- * @remarks
718
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
719
- */
720
- dedupe?: string[];
721
- /**
722
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
723
- */
724
- builtins?: (string | RegExp)[];
725
773
  /**
726
774
  * Configuration options for the preview server
727
775
  */
@@ -794,14 +842,26 @@ interface CommonUserConfig extends BaseConfig {
794
842
  */
795
843
  framework?: string;
796
844
  }
797
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
798
- build?: TBuildConfig & {
845
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
846
+ /**
847
+ * Configuration provided to build processes
848
+ *
849
+ * @remarks
850
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
851
+ */
852
+ build: Omit<TBuildConfig, "override"> & {
799
853
  /**
800
854
  * The build variant being used by the Powerlines engine.
801
855
  */
802
856
  variant?: TBuildVariant;
857
+ /**
858
+ * An optional set of override options to apply to the selected build variant.
859
+ *
860
+ * @remarks
861
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
862
+ */
863
+ override?: Partial<TBuildResolvedConfig>;
803
864
  };
804
- override?: Partial<TBuildResolvedConfig>;
805
865
  };
806
866
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
807
867
  /**
@@ -824,7 +884,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
824
884
  */
825
885
  output?: string;
826
886
  }
827
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
887
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
828
888
  /**
829
889
  * The name of the environment
830
890
  */
@@ -841,7 +901,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
841
901
  /**
842
902
  * The resolved options for the Powerlines project configuration.
843
903
  */
844
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "root" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "override" | "framework">> & {
904
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "framework">> & {
845
905
  /**
846
906
  * The configuration options that were provided inline to the Powerlines CLI.
847
907
  */
@@ -872,6 +932,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
872
932
  * The output configuration options to use for the build process
873
933
  */
874
934
  output: OutputResolvedConfig;
935
+ /**
936
+ * Configuration provided to build processes
937
+ *
938
+ * @remarks
939
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
940
+ */
941
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
875
942
  /**
876
943
  * The log level to use for the Powerlines processes.
877
944
  *
@@ -925,7 +992,13 @@ interface InitContextOptions {
925
992
  */
926
993
  isHighPriority: boolean;
927
994
  }
928
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
995
+ /**
996
+ * The unresolved Powerlines context.
997
+ *
998
+ * @remarks
999
+ * This context is used before the user configuration has been fully resolved after the `config`.
1000
+ */
1001
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
929
1002
  /**
930
1003
  * The Storm workspace configuration
931
1004
  */
@@ -933,7 +1006,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
933
1006
  /**
934
1007
  * An object containing the options provided to Powerlines
935
1008
  */
936
- config: TResolvedConfig;
1009
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1010
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1011
+ output: TResolvedConfig["output"];
1012
+ };
937
1013
  /**
938
1014
  * A logging function for the Powerlines engine
939
1015
  */
@@ -1090,6 +1166,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1090
1166
  */
1091
1167
  extendLog: (name: string) => LogFn;
1092
1168
  }
1169
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1170
+ /**
1171
+ * The fully resolved Powerlines configuration
1172
+ */
1173
+ config: TResolvedConfig;
1174
+ };
1093
1175
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1094
1176
  /**
1095
1177
  * The environment specific resolved configuration
@@ -1130,6 +1212,10 @@ interface GenerateTypesResult {
1130
1212
  directives?: string[];
1131
1213
  code: string;
1132
1214
  }
1215
+ type DeepPartial<T> = {
1216
+ [K in keyof T]?: DeepPartial<T[K]>;
1217
+ };
1218
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1133
1219
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1134
1220
  /**
1135
1221
  * A function that returns configuration options to be merged with the build context's options.
@@ -1145,7 +1231,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1145
1231
  * @param config - The partial configuration object to be modified.
1146
1232
  * @returns A promise that resolves to a partial configuration object.
1147
1233
  */
1148
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1234
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1149
1235
  /**
1150
1236
  * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
1151
1237
  *
@@ -1248,7 +1334,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1248
1334
  * @param config - The partial configuration object to be modified.
1249
1335
  * @returns A promise that resolves to a partial configuration object.
1250
1336
  */
1251
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1337
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1252
1338
  /**
1253
1339
  * A hook that is called to transform the source code.
1254
1340
  *
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from './index-Du8LdyRW.cjs';
2
- export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from './index-Du8LdyRW.cjs';
1
+ import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from './index-DJaHMe57.cjs';
2
+ export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from './index-DJaHMe57.cjs';
3
3
  export { TOCOptions } from './types/toc.cjs';
4
4
  import 'automd';
5
5
  import '@storm-software/build-tools/types';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from './index-BKS-6BIR.js';
2
- export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from './index-BKS-6BIR.js';
1
+ import { A as AutoMDPluginContext, a as AutoMDPluginOptions, P as Plugin } from './index-BXJKmBf-.js';
2
+ export { c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from './index-BXJKmBf-.js';
3
3
  export { TOCOptions } from './types/toc.js';
4
4
  import 'automd';
5
5
  import '@storm-software/build-tools/types';
@@ -1,4 +1,4 @@
1
- export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-Du8LdyRW.cjs';
1
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-DJaHMe57.cjs';
2
2
  export { TOCOptions } from './toc.cjs';
3
3
  import 'automd';
4
4
  import '@storm-software/build-tools/types';
@@ -1,4 +1,4 @@
1
- export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-BKS-6BIR.js';
1
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-BXJKmBf-.js';
2
2
  export { TOCOptions } from './toc.js';
3
3
  import 'automd';
4
4
  import '@storm-software/build-tools/types';
@@ -1,5 +1,5 @@
1
1
  import 'automd';
2
- export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-Du8LdyRW.cjs';
2
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-DJaHMe57.cjs';
3
3
  import './toc.cjs';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
@@ -1,5 +1,5 @@
1
1
  import 'automd';
2
- export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-BKS-6BIR.js';
2
+ export { A as AutoMDPluginContext, a as AutoMDPluginOptions, c as AutoMDPluginResolvedConfig, b as AutoMDPluginUserConfig } from '../index-BXJKmBf-.js';
3
3
  import './toc.js';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-automd",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to maintain a project's markdown files using AutoMD generators.",
6
6
  "repository": {
@@ -107,14 +107,14 @@
107
107
  "c12": "^3.3.2",
108
108
  "defu": "^6.1.4",
109
109
  "markdown-toc": "^1.2.0",
110
- "powerlines": "^0.19.4"
110
+ "powerlines": "^0.20.0"
111
111
  },
112
112
  "devDependencies": {
113
- "@powerlines/nx": "^0.10.8",
114
- "@powerlines/plugin-plugin": "^0.11.16",
113
+ "@powerlines/nx": "^0.10.10",
114
+ "@powerlines/plugin-plugin": "^0.11.18",
115
115
  "@types/node": "^22.19.1",
116
116
  "automd": "^0.4.2"
117
117
  },
118
118
  "publishConfig": { "access": "public" },
119
- "gitHead": "ab4911e45335c3ac4d162831f770181585c0d26f"
119
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
120
120
  }