@powerlines/plugin-openapi 0.2.12 → 0.2.14

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