@powerlines/plugin-vite 0.14.9 → 0.14.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.
@@ -1,7 +1,8 @@
1
1
  export { createVitePlugin } from './unplugin.cjs';
2
2
  import 'vite';
3
- import '../index-C9Wkx7zv.cjs';
3
+ import '../index-DHzRz0ZN.cjs';
4
4
  import '@stryke/env/get-env-paths';
5
+ import '@stryke/types/base';
5
6
  import '@stryke/types/package-json';
6
7
  import 'jiti';
7
8
  import 'oxc-parser';
@@ -10,7 +11,6 @@ import 'unplugin';
10
11
  import '@storm-software/build-tools/types';
11
12
  import '@storm-software/config-tools/types';
12
13
  import '@storm-software/config/types';
13
- import '@stryke/types/base';
14
14
  import '@stryke/types/configuration';
15
15
  import '@stryke/types/file';
16
16
  import '@stryke/types/array';
@@ -1,7 +1,8 @@
1
1
  export { createVitePlugin } from './unplugin.js';
2
2
  import 'vite';
3
- import '../index-C9Wkx7zv.js';
3
+ import '../index-DHzRz0ZN.js';
4
4
  import '@stryke/env/get-env-paths';
5
+ import '@stryke/types/base';
5
6
  import '@stryke/types/package-json';
6
7
  import 'jiti';
7
8
  import 'oxc-parser';
@@ -10,7 +11,6 @@ import 'unplugin';
10
11
  import '@storm-software/build-tools/types';
11
12
  import '@storm-software/config-tools/types';
12
13
  import '@storm-software/config/types';
13
- import '@stryke/types/base';
14
14
  import '@stryke/types/configuration';
15
15
  import '@stryke/types/file';
16
16
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
1
  import * as vite from 'vite';
2
- import { V as VitePluginContext } from '../index-C9Wkx7zv.cjs';
2
+ import { V as VitePluginContext } from '../index-DHzRz0ZN.cjs';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
1
  import * as vite from 'vite';
2
- import { V as VitePluginContext } from '../index-C9Wkx7zv.js';
2
+ import { V as VitePluginContext } from '../index-DHzRz0ZN.js';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
@@ -1,5 +1,6 @@
1
1
  import { UserConfig as UserConfig$1, PreviewOptions, ResolvedPreviewOptions } from 'vite';
2
2
  import { EnvPaths } from '@stryke/env/get-env-paths';
3
+ import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
3
4
  import { PackageJson } from '@stryke/types/package-json';
4
5
  import { Jiti } from 'jiti';
5
6
  import { ParserOptions, ParseResult } from 'oxc-parser';
@@ -8,7 +9,6 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
8
9
  import { Format } from '@storm-software/build-tools/types';
9
10
  import { LogLevelLabel } from '@storm-software/config-tools/types';
10
11
  import { StormWorkspaceConfig } from '@storm-software/config/types';
11
- import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
12
12
  import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
13
13
  import { AssetGlob } from '@stryke/types/file';
14
14
  import { ArrayValues } from '@stryke/types/array';
@@ -27,6 +27,73 @@ interface BuildConfig {
27
27
  * @defaultValue "neutral"
28
28
  */
29
29
  platform?: "node" | "browser" | "neutral";
30
+ /**
31
+ * 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.
32
+ *
33
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
34
+ */
35
+ mainFields?: string[];
36
+ /**
37
+ * Array of strings indicating what conditions should be used for module resolution.
38
+ */
39
+ conditions?: string[];
40
+ /**
41
+ * Array of strings indicating what file extensions should be used for module resolution.
42
+ *
43
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
44
+ */
45
+ extensions?: string[];
46
+ /**
47
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
48
+ *
49
+ * @remarks
50
+ * 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.
51
+ */
52
+ dedupe?: string[];
53
+ /**
54
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
55
+ */
56
+ builtins?: (string | RegExp)[];
57
+ /**
58
+ * Define global variable replacements.
59
+ *
60
+ * @remarks
61
+ * 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.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * {
66
+ * define: {
67
+ * __VERSION__: '"1.0.0"',
68
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
69
+ * }
70
+ * }
71
+ * ```
72
+ *
73
+ * @see https://esbuild.github.io/api/#define
74
+ * @see https://vitejs.dev/config/build-options.html#define
75
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
76
+ */
77
+ define?: Record<string, any>;
78
+ /**
79
+ * Global variables that will have import statements injected where necessary
80
+ *
81
+ * @remarks
82
+ * 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.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * {
87
+ * inject: {
88
+ * process: 'process/browser',
89
+ * Buffer: ['buffer', 'Buffer'],
90
+ * }
91
+ * }
92
+ * ```
93
+ *
94
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
95
+ */
96
+ inject?: Record<string, string | string[]>;
30
97
  /**
31
98
  * The alias mappings to use for module resolution during the build process.
32
99
  *
@@ -42,6 +109,8 @@ interface BuildConfig {
42
109
  * }
43
110
  * }
44
111
  * ```
112
+ *
113
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
45
114
  */
46
115
  alias?: Record<string, string>;
47
116
  /**
@@ -60,13 +129,14 @@ interface BuildConfig {
60
129
  */
61
130
  skipNodeModulesBundle?: boolean;
62
131
  /**
63
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
132
+ * An optional set of override options to apply to the selected build variant.
64
133
  *
65
- * @defaultValue false
134
+ * @remarks
135
+ * 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.
66
136
  */
67
- skipPrepare?: boolean;
137
+ override?: Record<string, any>;
68
138
  }
69
- type BuildResolvedConfig = BuildConfig;
139
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
70
140
  type ViteBuildConfig = Omit<UserConfig$1, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig;
71
141
  type ViteResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
72
142
 
@@ -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 ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
807
867
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
@@ -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
  *
@@ -927,7 +994,13 @@ interface InitContextOptions {
927
994
  */
928
995
  isHighPriority: boolean;
929
996
  }
930
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
997
+ /**
998
+ * The unresolved Powerlines context.
999
+ *
1000
+ * @remarks
1001
+ * This context is used before the user configuration has been fully resolved after the `config`.
1002
+ */
1003
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
931
1004
  /**
932
1005
  * The Storm workspace configuration
933
1006
  */
@@ -935,7 +1008,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
935
1008
  /**
936
1009
  * An object containing the options provided to Powerlines
937
1010
  */
938
- config: TResolvedConfig;
1011
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1012
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1013
+ output: TResolvedConfig["output"];
1014
+ };
939
1015
  /**
940
1016
  * A logging function for the Powerlines engine
941
1017
  */
@@ -1092,6 +1168,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1092
1168
  */
1093
1169
  extendLog: (name: string) => LogFn;
1094
1170
  }
1171
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1172
+ /**
1173
+ * The fully resolved Powerlines configuration
1174
+ */
1175
+ config: TResolvedConfig;
1176
+ };
1095
1177
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1096
1178
  /**
1097
1179
  * The environment specific resolved configuration
@@ -1132,6 +1214,10 @@ interface GenerateTypesResult {
1132
1214
  directives?: string[];
1133
1215
  code: string;
1134
1216
  }
1217
+ type DeepPartial<T> = {
1218
+ [K in keyof T]?: DeepPartial<T[K]>;
1219
+ };
1220
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1135
1221
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1136
1222
  /**
1137
1223
  * A function that returns configuration options to be merged with the build context's options.
@@ -1147,7 +1233,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1147
1233
  * @param config - The partial configuration object to be modified.
1148
1234
  * @returns A promise that resolves to a partial configuration object.
1149
1235
  */
1150
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1236
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1151
1237
  /**
1152
1238
  * 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.
1153
1239
  *
@@ -1250,7 +1336,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1250
1336
  * @param config - The partial configuration object to be modified.
1251
1337
  * @returns A promise that resolves to a partial configuration object.
1252
1338
  */
1253
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1339
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1254
1340
  /**
1255
1341
  * A hook that is called to transform the source code.
1256
1342
  *
@@ -1,5 +1,6 @@
1
1
  import { UserConfig as UserConfig$1, PreviewOptions, ResolvedPreviewOptions } from 'vite';
2
2
  import { EnvPaths } from '@stryke/env/get-env-paths';
3
+ import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
3
4
  import { PackageJson } from '@stryke/types/package-json';
4
5
  import { Jiti } from 'jiti';
5
6
  import { ParserOptions, ParseResult } from 'oxc-parser';
@@ -8,7 +9,6 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
8
9
  import { Format } from '@storm-software/build-tools/types';
9
10
  import { LogLevelLabel } from '@storm-software/config-tools/types';
10
11
  import { StormWorkspaceConfig } from '@storm-software/config/types';
11
- import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
12
12
  import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
13
13
  import { AssetGlob } from '@stryke/types/file';
14
14
  import { ArrayValues } from '@stryke/types/array';
@@ -27,6 +27,73 @@ interface BuildConfig {
27
27
  * @defaultValue "neutral"
28
28
  */
29
29
  platform?: "node" | "browser" | "neutral";
30
+ /**
31
+ * 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.
32
+ *
33
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
34
+ */
35
+ mainFields?: string[];
36
+ /**
37
+ * Array of strings indicating what conditions should be used for module resolution.
38
+ */
39
+ conditions?: string[];
40
+ /**
41
+ * Array of strings indicating what file extensions should be used for module resolution.
42
+ *
43
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
44
+ */
45
+ extensions?: string[];
46
+ /**
47
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
48
+ *
49
+ * @remarks
50
+ * 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.
51
+ */
52
+ dedupe?: string[];
53
+ /**
54
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
55
+ */
56
+ builtins?: (string | RegExp)[];
57
+ /**
58
+ * Define global variable replacements.
59
+ *
60
+ * @remarks
61
+ * 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.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * {
66
+ * define: {
67
+ * __VERSION__: '"1.0.0"',
68
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
69
+ * }
70
+ * }
71
+ * ```
72
+ *
73
+ * @see https://esbuild.github.io/api/#define
74
+ * @see https://vitejs.dev/config/build-options.html#define
75
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
76
+ */
77
+ define?: Record<string, any>;
78
+ /**
79
+ * Global variables that will have import statements injected where necessary
80
+ *
81
+ * @remarks
82
+ * 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.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * {
87
+ * inject: {
88
+ * process: 'process/browser',
89
+ * Buffer: ['buffer', 'Buffer'],
90
+ * }
91
+ * }
92
+ * ```
93
+ *
94
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
95
+ */
96
+ inject?: Record<string, string | string[]>;
30
97
  /**
31
98
  * The alias mappings to use for module resolution during the build process.
32
99
  *
@@ -42,6 +109,8 @@ interface BuildConfig {
42
109
  * }
43
110
  * }
44
111
  * ```
112
+ *
113
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
45
114
  */
46
115
  alias?: Record<string, string>;
47
116
  /**
@@ -60,13 +129,14 @@ interface BuildConfig {
60
129
  */
61
130
  skipNodeModulesBundle?: boolean;
62
131
  /**
63
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
132
+ * An optional set of override options to apply to the selected build variant.
64
133
  *
65
- * @defaultValue false
134
+ * @remarks
135
+ * 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.
66
136
  */
67
- skipPrepare?: boolean;
137
+ override?: Record<string, any>;
68
138
  }
69
- type BuildResolvedConfig = BuildConfig;
139
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
70
140
  type ViteBuildConfig = Omit<UserConfig$1, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig;
71
141
  type ViteResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
72
142
 
@@ -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 ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
807
867
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
@@ -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
  *
@@ -927,7 +994,13 @@ interface InitContextOptions {
927
994
  */
928
995
  isHighPriority: boolean;
929
996
  }
930
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
997
+ /**
998
+ * The unresolved Powerlines context.
999
+ *
1000
+ * @remarks
1001
+ * This context is used before the user configuration has been fully resolved after the `config`.
1002
+ */
1003
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
931
1004
  /**
932
1005
  * The Storm workspace configuration
933
1006
  */
@@ -935,7 +1008,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
935
1008
  /**
936
1009
  * An object containing the options provided to Powerlines
937
1010
  */
938
- config: TResolvedConfig;
1011
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1012
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1013
+ output: TResolvedConfig["output"];
1014
+ };
939
1015
  /**
940
1016
  * A logging function for the Powerlines engine
941
1017
  */
@@ -1092,6 +1168,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1092
1168
  */
1093
1169
  extendLog: (name: string) => LogFn;
1094
1170
  }
1171
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1172
+ /**
1173
+ * The fully resolved Powerlines configuration
1174
+ */
1175
+ config: TResolvedConfig;
1176
+ };
1095
1177
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1096
1178
  /**
1097
1179
  * The environment specific resolved configuration
@@ -1132,6 +1214,10 @@ interface GenerateTypesResult {
1132
1214
  directives?: string[];
1133
1215
  code: string;
1134
1216
  }
1217
+ type DeepPartial<T> = {
1218
+ [K in keyof T]?: DeepPartial<T[K]>;
1219
+ };
1220
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1135
1221
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1136
1222
  /**
1137
1223
  * A function that returns configuration options to be merged with the build context's options.
@@ -1147,7 +1233,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1147
1233
  * @param config - The partial configuration object to be modified.
1148
1234
  * @returns A promise that resolves to a partial configuration object.
1149
1235
  */
1150
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1236
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1151
1237
  /**
1152
1238
  * 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.
1153
1239
  *
@@ -1250,7 +1336,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1250
1336
  * @param config - The partial configuration object to be modified.
1251
1337
  * @returns A promise that resolves to a partial configuration object.
1252
1338
  */
1253
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1339
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1254
1340
  /**
1255
1341
  * A hook that is called to transform the source code.
1256
1342
  *
package/dist/index.d.cts CHANGED
@@ -1,8 +1,9 @@
1
- import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-C9Wkx7zv.cjs';
2
- export { b as VitePluginResolvedConfig } from './index-C9Wkx7zv.cjs';
1
+ import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-DHzRz0ZN.cjs';
2
+ export { b as VitePluginResolvedConfig } from './index-DHzRz0ZN.cjs';
3
3
  export { createVitePlugin } from './helpers/unplugin.cjs';
4
4
  import 'vite';
5
5
  import '@stryke/env/get-env-paths';
6
+ import '@stryke/types/base';
6
7
  import '@stryke/types/package-json';
7
8
  import 'jiti';
8
9
  import 'oxc-parser';
@@ -11,7 +12,6 @@ import 'unplugin';
11
12
  import '@storm-software/build-tools/types';
12
13
  import '@storm-software/config-tools/types';
13
14
  import '@storm-software/config/types';
14
- import '@stryke/types/base';
15
15
  import '@stryke/types/configuration';
16
16
  import '@stryke/types/file';
17
17
  import '@stryke/types/array';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-C9Wkx7zv.js';
2
- export { b as VitePluginResolvedConfig } from './index-C9Wkx7zv.js';
1
+ import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-DHzRz0ZN.js';
2
+ export { b as VitePluginResolvedConfig } from './index-DHzRz0ZN.js';
3
3
  export { createVitePlugin } from './helpers/unplugin.js';
4
4
  import 'vite';
5
5
  import '@stryke/env/get-env-paths';
6
+ import '@stryke/types/base';
6
7
  import '@stryke/types/package-json';
7
8
  import 'jiti';
8
9
  import 'oxc-parser';
@@ -11,7 +12,6 @@ import 'unplugin';
11
12
  import '@storm-software/build-tools/types';
12
13
  import '@storm-software/config-tools/types';
13
14
  import '@storm-software/config/types';
14
- import '@stryke/types/base';
15
15
  import '@stryke/types/configuration';
16
16
  import '@stryke/types/file';
17
17
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
- export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-C9Wkx7zv.cjs';
1
+ export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-DHzRz0ZN.cjs';
2
2
  import 'vite';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
- export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-C9Wkx7zv.js';
1
+ export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-DHzRz0ZN.js';
2
2
  import 'vite';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
- export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-C9Wkx7zv.cjs';
1
+ export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-DHzRz0ZN.cjs';
2
2
  import 'vite';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
@@ -1,6 +1,7 @@
1
- export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-C9Wkx7zv.js';
1
+ export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-DHzRz0ZN.js';
2
2
  import 'vite';
3
3
  import '@stryke/env/get-env-paths';
4
+ import '@stryke/types/base';
4
5
  import '@stryke/types/package-json';
5
6
  import 'jiti';
6
7
  import 'oxc-parser';
@@ -9,7 +10,6 @@ import 'unplugin';
9
10
  import '@storm-software/build-tools/types';
10
11
  import '@storm-software/config-tools/types';
11
12
  import '@storm-software/config/types';
12
- import '@stryke/types/base';
13
13
  import '@stryke/types/configuration';
14
14
  import '@stryke/types/file';
15
15
  import '@stryke/types/array';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-vite",
3
- "version": "0.14.9",
3
+ "version": "0.14.10",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin to assist in developing other Powerlines plugins.",
6
6
  "repository": {
@@ -138,15 +138,15 @@
138
138
  "@stryke/types": "^0.10.2",
139
139
  "defu": "^6.1.4",
140
140
  "jiti": "^2.6.1",
141
- "powerlines": "^0.19.5"
141
+ "powerlines": "^0.20.0"
142
142
  },
143
143
  "devDependencies": {
144
144
  "vite": "^7.2.2",
145
145
  "rolldown-vite": "^7.2.5",
146
- "@powerlines/nx": "^0.10.9",
147
- "@powerlines/plugin-plugin": "^0.11.17",
146
+ "@powerlines/nx": "^0.10.10",
147
+ "@powerlines/plugin-plugin": "^0.11.18",
148
148
  "@types/node": "^22.19.1"
149
149
  },
150
150
  "publishConfig": { "access": "public" },
151
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
151
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
152
152
  }