@powerlines/plugin-tsup 0.12.17 → 0.12.19

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.
@@ -1,6 +1,6 @@
1
1
  export { createTsupPlugin } from './unplugin.cjs';
2
2
  import 'esbuild';
3
- import '../index-C_qoO2U3.cjs';
3
+ import '../index-Bt1HdevD.cjs';
4
4
  import '@storm-software/tsup/types';
5
5
  import '@storm-software/build-tools/types';
6
6
  import '@storm-software/config-tools/types';
@@ -1,6 +1,6 @@
1
1
  export { createTsupPlugin } from './unplugin.js';
2
2
  import 'esbuild';
3
- import '../index-C_qoO2U3.js';
3
+ import '../index-Bt1HdevD.js';
4
4
  import '@storm-software/tsup/types';
5
5
  import '@storm-software/build-tools/types';
6
6
  import '@storm-software/config-tools/types';
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { T as TsupPluginContext } from '../index-C_qoO2U3.cjs';
2
+ import { T as TsupPluginContext } from '../index-Bt1HdevD.cjs';
3
3
  import '@storm-software/tsup/types';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
@@ -1,5 +1,5 @@
1
1
  import * as esbuild from 'esbuild';
2
- import { T as TsupPluginContext } from '../index-C_qoO2U3.js';
2
+ import { T as TsupPluginContext } from '../index-Bt1HdevD.js';
3
3
  import '@storm-software/tsup/types';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
@@ -28,6 +28,73 @@ interface BuildConfig {
28
28
  * @defaultValue "neutral"
29
29
  */
30
30
  platform?: "node" | "browser" | "neutral";
31
+ /**
32
+ * 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.
33
+ *
34
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
35
+ */
36
+ mainFields?: string[];
37
+ /**
38
+ * Array of strings indicating what conditions should be used for module resolution.
39
+ */
40
+ conditions?: string[];
41
+ /**
42
+ * Array of strings indicating what file extensions should be used for module resolution.
43
+ *
44
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
45
+ */
46
+ extensions?: string[];
47
+ /**
48
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
49
+ *
50
+ * @remarks
51
+ * 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.
52
+ */
53
+ dedupe?: string[];
54
+ /**
55
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
56
+ */
57
+ builtins?: (string | RegExp)[];
58
+ /**
59
+ * Define global variable replacements.
60
+ *
61
+ * @remarks
62
+ * 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.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * {
67
+ * define: {
68
+ * __VERSION__: '"1.0.0"',
69
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
70
+ * }
71
+ * }
72
+ * ```
73
+ *
74
+ * @see https://esbuild.github.io/api/#define
75
+ * @see https://vitejs.dev/config/build-options.html#define
76
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
77
+ */
78
+ define?: Record<string, any>;
79
+ /**
80
+ * Global variables that will have import statements injected where necessary
81
+ *
82
+ * @remarks
83
+ * 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.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * {
88
+ * inject: {
89
+ * process: 'process/browser',
90
+ * Buffer: ['buffer', 'Buffer'],
91
+ * }
92
+ * }
93
+ * ```
94
+ *
95
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
96
+ */
97
+ inject?: Record<string, string | string[]>;
31
98
  /**
32
99
  * The alias mappings to use for module resolution during the build process.
33
100
  *
@@ -43,6 +110,8 @@ interface BuildConfig {
43
110
  * }
44
111
  * }
45
112
  * ```
113
+ *
114
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
46
115
  */
47
116
  alias?: Record<string, string>;
48
117
  /**
@@ -61,13 +130,14 @@ interface BuildConfig {
61
130
  */
62
131
  skipNodeModulesBundle?: boolean;
63
132
  /**
64
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
133
+ * An optional set of override options to apply to the selected build variant.
65
134
  *
66
- * @defaultValue false
135
+ * @remarks
136
+ * 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.
67
137
  */
68
- skipPrepare?: boolean;
138
+ override?: Record<string, any>;
69
139
  }
70
- type BuildResolvedConfig = BuildConfig;
140
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
71
141
  type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
72
142
  type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
73
143
 
@@ -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 TsupUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
808
868
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
@@ -826,7 +886,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
826
886
  */
827
887
  output?: string;
828
888
  }
829
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
889
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
830
890
  /**
831
891
  * The name of the environment
832
892
  */
@@ -843,7 +903,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
843
903
  /**
844
904
  * The resolved options for the Powerlines project configuration.
845
905
  */
846
- 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">> & {
906
+ 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">> & {
847
907
  /**
848
908
  * The configuration options that were provided inline to the Powerlines CLI.
849
909
  */
@@ -874,6 +934,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
874
934
  * The output configuration options to use for the build process
875
935
  */
876
936
  output: OutputResolvedConfig;
937
+ /**
938
+ * Configuration provided to build processes
939
+ *
940
+ * @remarks
941
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
942
+ */
943
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
877
944
  /**
878
945
  * The log level to use for the Powerlines processes.
879
946
  *
@@ -928,7 +995,13 @@ interface InitContextOptions {
928
995
  */
929
996
  isHighPriority: boolean;
930
997
  }
931
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
998
+ /**
999
+ * The unresolved Powerlines context.
1000
+ *
1001
+ * @remarks
1002
+ * This context is used before the user configuration has been fully resolved after the `config`.
1003
+ */
1004
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
932
1005
  /**
933
1006
  * The Storm workspace configuration
934
1007
  */
@@ -936,7 +1009,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
936
1009
  /**
937
1010
  * An object containing the options provided to Powerlines
938
1011
  */
939
- config: TResolvedConfig;
1012
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1013
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1014
+ output: TResolvedConfig["output"];
1015
+ };
940
1016
  /**
941
1017
  * A logging function for the Powerlines engine
942
1018
  */
@@ -1093,6 +1169,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1093
1169
  */
1094
1170
  extendLog: (name: string) => LogFn;
1095
1171
  }
1172
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1173
+ /**
1174
+ * The fully resolved Powerlines configuration
1175
+ */
1176
+ config: TResolvedConfig;
1177
+ };
1096
1178
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1097
1179
  /**
1098
1180
  * The environment specific resolved configuration
@@ -1133,6 +1215,10 @@ interface GenerateTypesResult {
1133
1215
  directives?: string[];
1134
1216
  code: string;
1135
1217
  }
1218
+ type DeepPartial<T> = {
1219
+ [K in keyof T]?: DeepPartial<T[K]>;
1220
+ };
1221
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1136
1222
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1137
1223
  /**
1138
1224
  * A function that returns configuration options to be merged with the build context's options.
@@ -1148,7 +1234,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1148
1234
  * @param config - The partial configuration object to be modified.
1149
1235
  * @returns A promise that resolves to a partial configuration object.
1150
1236
  */
1151
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1237
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1152
1238
  /**
1153
1239
  * 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.
1154
1240
  *
@@ -1251,7 +1337,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1251
1337
  * @param config - The partial configuration object to be modified.
1252
1338
  * @returns A promise that resolves to a partial configuration object.
1253
1339
  */
1254
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1340
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1255
1341
  /**
1256
1342
  * A hook that is called to transform the source code.
1257
1343
  *
@@ -28,6 +28,73 @@ interface BuildConfig {
28
28
  * @defaultValue "neutral"
29
29
  */
30
30
  platform?: "node" | "browser" | "neutral";
31
+ /**
32
+ * 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.
33
+ *
34
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
35
+ */
36
+ mainFields?: string[];
37
+ /**
38
+ * Array of strings indicating what conditions should be used for module resolution.
39
+ */
40
+ conditions?: string[];
41
+ /**
42
+ * Array of strings indicating what file extensions should be used for module resolution.
43
+ *
44
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
45
+ */
46
+ extensions?: string[];
47
+ /**
48
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
49
+ *
50
+ * @remarks
51
+ * 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.
52
+ */
53
+ dedupe?: string[];
54
+ /**
55
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
56
+ */
57
+ builtins?: (string | RegExp)[];
58
+ /**
59
+ * Define global variable replacements.
60
+ *
61
+ * @remarks
62
+ * 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.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * {
67
+ * define: {
68
+ * __VERSION__: '"1.0.0"',
69
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
70
+ * }
71
+ * }
72
+ * ```
73
+ *
74
+ * @see https://esbuild.github.io/api/#define
75
+ * @see https://vitejs.dev/config/build-options.html#define
76
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
77
+ */
78
+ define?: Record<string, any>;
79
+ /**
80
+ * Global variables that will have import statements injected where necessary
81
+ *
82
+ * @remarks
83
+ * 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.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * {
88
+ * inject: {
89
+ * process: 'process/browser',
90
+ * Buffer: ['buffer', 'Buffer'],
91
+ * }
92
+ * }
93
+ * ```
94
+ *
95
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
96
+ */
97
+ inject?: Record<string, string | string[]>;
31
98
  /**
32
99
  * The alias mappings to use for module resolution during the build process.
33
100
  *
@@ -43,6 +110,8 @@ interface BuildConfig {
43
110
  * }
44
111
  * }
45
112
  * ```
113
+ *
114
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
46
115
  */
47
116
  alias?: Record<string, string>;
48
117
  /**
@@ -61,13 +130,14 @@ interface BuildConfig {
61
130
  */
62
131
  skipNodeModulesBundle?: boolean;
63
132
  /**
64
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
133
+ * An optional set of override options to apply to the selected build variant.
65
134
  *
66
- * @defaultValue false
135
+ * @remarks
136
+ * 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.
67
137
  */
68
- skipPrepare?: boolean;
138
+ override?: Record<string, any>;
69
139
  }
70
- type BuildResolvedConfig = BuildConfig;
140
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
71
141
  type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
72
142
  type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
73
143
 
@@ -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 TsupUserConfig = UserConfig<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
808
868
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
@@ -826,7 +886,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
826
886
  */
827
887
  output?: string;
828
888
  }
829
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
889
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
830
890
  /**
831
891
  * The name of the environment
832
892
  */
@@ -843,7 +903,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
843
903
  /**
844
904
  * The resolved options for the Powerlines project configuration.
845
905
  */
846
- 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">> & {
906
+ 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">> & {
847
907
  /**
848
908
  * The configuration options that were provided inline to the Powerlines CLI.
849
909
  */
@@ -874,6 +934,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
874
934
  * The output configuration options to use for the build process
875
935
  */
876
936
  output: OutputResolvedConfig;
937
+ /**
938
+ * Configuration provided to build processes
939
+ *
940
+ * @remarks
941
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
942
+ */
943
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
877
944
  /**
878
945
  * The log level to use for the Powerlines processes.
879
946
  *
@@ -928,7 +995,13 @@ interface InitContextOptions {
928
995
  */
929
996
  isHighPriority: boolean;
930
997
  }
931
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
998
+ /**
999
+ * The unresolved Powerlines context.
1000
+ *
1001
+ * @remarks
1002
+ * This context is used before the user configuration has been fully resolved after the `config`.
1003
+ */
1004
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
932
1005
  /**
933
1006
  * The Storm workspace configuration
934
1007
  */
@@ -936,7 +1009,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
936
1009
  /**
937
1010
  * An object containing the options provided to Powerlines
938
1011
  */
939
- config: TResolvedConfig;
1012
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1013
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1014
+ output: TResolvedConfig["output"];
1015
+ };
940
1016
  /**
941
1017
  * A logging function for the Powerlines engine
942
1018
  */
@@ -1093,6 +1169,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1093
1169
  */
1094
1170
  extendLog: (name: string) => LogFn;
1095
1171
  }
1172
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1173
+ /**
1174
+ * The fully resolved Powerlines configuration
1175
+ */
1176
+ config: TResolvedConfig;
1177
+ };
1096
1178
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1097
1179
  /**
1098
1180
  * The environment specific resolved configuration
@@ -1133,6 +1215,10 @@ interface GenerateTypesResult {
1133
1215
  directives?: string[];
1134
1216
  code: string;
1135
1217
  }
1218
+ type DeepPartial<T> = {
1219
+ [K in keyof T]?: DeepPartial<T[K]>;
1220
+ };
1221
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1136
1222
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1137
1223
  /**
1138
1224
  * A function that returns configuration options to be merged with the build context's options.
@@ -1148,7 +1234,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1148
1234
  * @param config - The partial configuration object to be modified.
1149
1235
  * @returns A promise that resolves to a partial configuration object.
1150
1236
  */
1151
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1237
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1152
1238
  /**
1153
1239
  * 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.
1154
1240
  *
@@ -1251,7 +1337,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1251
1337
  * @param config - The partial configuration object to be modified.
1252
1338
  * @returns A promise that resolves to a partial configuration object.
1253
1339
  */
1254
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1340
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1255
1341
  /**
1256
1342
  * A hook that is called to transform the source code.
1257
1343
  *
package/dist/index.cjs CHANGED
@@ -4,4 +4,4 @@
4
4
  *
5
5
  *****************************************/
6
6
 
7
- const c=chunkFBBMZ4NC_cjs.a((n={})=>({name:"tsup",config(){return this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:["cjs","esm"]},build:{...n,variant:"tsup"}}},async build(){return tsup.build(await tsup.resolveOptions(a__default.default({config:false,entry:Object.fromEntries(Object.entries(tsup$1.resolveTsupEntry(this,this.entry)).map(([i,t])=>[i,append.appendPath(t,this.config.projectRoot)])),esbuildOptions:chunkFBBMZ4NC_cjs.a((i,t)=>{this.config.build.variant==="tsup"&&(this.config.build.esbuildOptions?this.config.build.esbuildOptions?.(i,t):this.config.override.esbuildOptions&&this.config.override.esbuildOptions?.(i,t)),i.alias={...this.builtins.reduce((o,e)=>{const r=this.fs.ids[e];return r&&(o[e]=r),o},{}),...i.alias};},"esbuildOptions"),silent:false,verbose:true},tsup$1.extractTsupConfig(this),{esbuildPlugins:[unplugin.createTsupPlugin(this)]})))}}),"plugin");var A=c;exports.default=A;exports.plugin=c;Object.keys(helpers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return helpers[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
7
+ const c=chunkFBBMZ4NC_cjs.a((r={})=>({name:"tsup",config(){return this.log(types$1.LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:["cjs","esm"]},build:{...r,variant:"tsup"}}},async build(){return tsup.build(await tsup.resolveOptions(a__default.default({config:false,entry:Object.fromEntries(Object.entries(tsup$1.resolveTsupEntry(this,this.entry)).map(([i,t])=>[i,append.appendPath(t,this.config.projectRoot)])),esbuildOptions:chunkFBBMZ4NC_cjs.a((i,t)=>{this.config.build.variant==="tsup"&&this.config.build.esbuildOptions&&this.config.build.esbuildOptions?.(i,t),i.alias={...this.builtins.reduce((s,e)=>{const n=this.fs.ids[e];return n&&(s[e]=n),s},{}),...i.alias};},"esbuildOptions"),silent:false,verbose:true},tsup$1.extractTsupConfig(this),{esbuildPlugins:[unplugin.createTsupPlugin(this)]})))}}),"plugin");var A=c;exports.default=A;exports.plugin=c;Object.keys(helpers).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return helpers[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TsupPluginContext, a as TsupPluginOptions, P as Plugin } from './index-C_qoO2U3.cjs';
2
- export { c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from './index-C_qoO2U3.cjs';
1
+ import { T as TsupPluginContext, a as TsupPluginOptions, P as Plugin } from './index-Bt1HdevD.cjs';
2
+ export { c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from './index-Bt1HdevD.cjs';
3
3
  export { createTsupPlugin } from './helpers/unplugin.cjs';
4
4
  import '@storm-software/tsup/types';
5
5
  import '@storm-software/build-tools/types';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TsupPluginContext, a as TsupPluginOptions, P as Plugin } from './index-C_qoO2U3.js';
2
- export { c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from './index-C_qoO2U3.js';
1
+ import { T as TsupPluginContext, a as TsupPluginOptions, P as Plugin } from './index-Bt1HdevD.js';
2
+ export { c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from './index-Bt1HdevD.js';
3
3
  export { createTsupPlugin } from './helpers/unplugin.js';
4
4
  import '@storm-software/tsup/types';
5
5
  import '@storm-software/build-tools/types';
package/dist/index.js CHANGED
@@ -4,4 +4,4 @@ import {a}from'./chunk-UCUR73HG.js';import {LogLevelLabel}from'@storm-software/c
4
4
  *
5
5
  *****************************************/
6
6
 
7
- const c=a((n={})=>({name:"tsup",config(){return this.log(LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:["cjs","esm"]},build:{...n,variant:"tsup"}}},async build(){return build(await resolveOptions(a$1({config:false,entry:Object.fromEntries(Object.entries(resolveTsupEntry(this,this.entry)).map(([i,t])=>[i,appendPath(t,this.config.projectRoot)])),esbuildOptions:a((i,t)=>{this.config.build.variant==="tsup"&&(this.config.build.esbuildOptions?this.config.build.esbuildOptions?.(i,t):this.config.override.esbuildOptions&&this.config.override.esbuildOptions?.(i,t)),i.alias={...this.builtins.reduce((o,e)=>{const r=this.fs.ids[e];return r&&(o[e]=r),o},{}),...i.alias};},"esbuildOptions"),silent:false,verbose:true},extractTsupConfig(this),{esbuildPlugins:[createTsupPlugin(this)]})))}}),"plugin");var k=c;export{k as default,c as plugin};
7
+ const c=a((r={})=>({name:"tsup",config(){return this.log(LogLevelLabel.TRACE,"Providing default configuration for the Powerlines `tsup` build plugin."),{output:{format:["cjs","esm"]},build:{...r,variant:"tsup"}}},async build(){return build(await resolveOptions(a$1({config:false,entry:Object.fromEntries(Object.entries(resolveTsupEntry(this,this.entry)).map(([i,t])=>[i,appendPath(t,this.config.projectRoot)])),esbuildOptions:a((i,t)=>{this.config.build.variant==="tsup"&&this.config.build.esbuildOptions&&this.config.build.esbuildOptions?.(i,t),i.alias={...this.builtins.reduce((s,e)=>{const n=this.fs.ids[e];return n&&(s[e]=n),s},{}),...i.alias};},"esbuildOptions"),silent:false,verbose:true},extractTsupConfig(this),{esbuildPlugins:[createTsupPlugin(this)]})))}}),"plugin");var k=c;export{k as default,c as plugin};
@@ -1,4 +1,4 @@
1
- export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-C_qoO2U3.cjs';
1
+ export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-Bt1HdevD.cjs';
2
2
  import '@storm-software/tsup/types';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
@@ -1,4 +1,4 @@
1
- export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-C_qoO2U3.js';
1
+ export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-Bt1HdevD.js';
2
2
  import '@storm-software/tsup/types';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
@@ -1,4 +1,4 @@
1
- export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-C_qoO2U3.cjs';
1
+ export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-Bt1HdevD.cjs';
2
2
  import '@storm-software/tsup/types';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
@@ -1,4 +1,4 @@
1
- export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-C_qoO2U3.js';
1
+ export { T as TsupPluginContext, a as TsupPluginOptions, c as TsupPluginResolvedConfig, b as TsupPluginUserConfig } from '../index-Bt1HdevD.js';
2
2
  import '@storm-software/tsup/types';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-tsup",
3
- "version": "0.12.17",
3
+ "version": "0.12.19",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -127,18 +127,18 @@
127
127
  "files": ["dist/**/*"],
128
128
  "keywords": ["tsup", "powerlines", "storm-software", "powerlines-plugin"],
129
129
  "dependencies": {
130
- "@storm-software/tsup": "^0.2.36",
130
+ "@storm-software/tsup": "^0.2.38",
131
131
  "@stryke/path": "^0.19.2",
132
132
  "@stryke/type-checks": "^0.3.12",
133
133
  "@stryke/types": "^0.10.2",
134
134
  "defu": "^6.1.4",
135
- "powerlines": "^0.19.4"
135
+ "powerlines": "^0.20.0"
136
136
  },
137
137
  "devDependencies": {
138
- "@powerlines/nx": "^0.10.8",
139
- "@powerlines/plugin-plugin": "^0.11.16",
138
+ "@powerlines/nx": "^0.10.10",
139
+ "@powerlines/plugin-plugin": "^0.11.18",
140
140
  "@types/node": "^22.19.1"
141
141
  },
142
142
  "publishConfig": { "access": "public" },
143
- "gitHead": "ab4911e45335c3ac4d162831f770181585c0d26f"
143
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
144
144
  }