@powerlines/plugin-id 0.9.17 → 0.9.18

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,5 +1,5 @@
1
1
  export { nanoidModule } from './nanoid.cjs';
2
- import '../index-UhS6IjOH.cjs';
2
+ import '../index-BLWbGMpG.cjs';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
5
5
  import '@storm-software/config/types';
@@ -1,5 +1,5 @@
1
1
  export { nanoidModule } from './nanoid.js';
2
- import '../index-UhS6IjOH.js';
2
+ import '../index-BLWbGMpG.js';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
5
5
  import '@storm-software/config/types';
@@ -1,4 +1,4 @@
1
- import { a as IdPluginContext } from '../index-UhS6IjOH.cjs';
1
+ import { a as IdPluginContext } from '../index-BLWbGMpG.cjs';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -1,4 +1,4 @@
1
- import { a as IdPluginContext } from '../index-UhS6IjOH.js';
1
+ import { a as IdPluginContext } from '../index-BLWbGMpG.js';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -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
 
71
141
  type ReflectionMode = "default" | "explicit" | "never";
72
142
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -642,24 +712,33 @@ interface BaseConfig {
642
712
  * The entry point(s) for the application
643
713
  */
644
714
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
715
+ /**
716
+ * Configuration for the output of the build process
717
+ */
718
+ output?: OutputConfig;
645
719
  /**
646
720
  * Configuration for linting the source code
721
+ *
722
+ * @remarks
723
+ * If set to `false`, linting will be disabled.
647
724
  */
648
725
  lint?: Record<string, any> | false;
649
726
  /**
650
727
  * Configuration for testing the source code
728
+ *
729
+ * @remarks
730
+ * If set to `false`, testing will be disabled.
651
731
  */
652
732
  test?: Record<string, any> | false;
653
- /**
654
- * Configuration for the output of the build process
655
- */
656
- output?: OutputConfig;
657
733
  /**
658
734
  * Configuration for the transformation of the source code
659
735
  */
660
736
  transform?: Record<string, any>;
661
737
  /**
662
- * Options to to provide to the build process
738
+ * Configuration provided to build processes
739
+ *
740
+ * @remarks
741
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
663
742
  */
664
743
  build?: BuildConfig;
665
744
  /**
@@ -689,37 +768,6 @@ interface BaseConfig {
689
768
  tsconfigRaw?: TSConfig;
690
769
  }
691
770
  interface EnvironmentConfig extends BaseConfig {
692
- /**
693
- * 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.
694
- *
695
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
696
- */
697
- mainFields?: string[];
698
- /**
699
- * Array of strings indicating what conditions should be used for module resolution.
700
- */
701
- conditions?: string[];
702
- /**
703
- * Array of strings indicating what conditions should be used for external modules.
704
- */
705
- externalConditions?: string[];
706
- /**
707
- * Array of strings indicating what file extensions should be used for module resolution.
708
- *
709
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
710
- */
711
- extensions?: string[];
712
- /**
713
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
714
- *
715
- * @remarks
716
- * 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.
717
- */
718
- dedupe?: string[];
719
- /**
720
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
721
- */
722
- builtins?: (string | RegExp)[];
723
771
  /**
724
772
  * Configuration options for the preview server
725
773
  */
@@ -792,14 +840,26 @@ interface CommonUserConfig extends BaseConfig {
792
840
  */
793
841
  framework?: string;
794
842
  }
795
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
796
- build?: TBuildConfig & {
843
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
844
+ /**
845
+ * Configuration provided to build processes
846
+ *
847
+ * @remarks
848
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
849
+ */
850
+ build: Omit<TBuildConfig, "override"> & {
797
851
  /**
798
852
  * The build variant being used by the Powerlines engine.
799
853
  */
800
854
  variant?: TBuildVariant;
855
+ /**
856
+ * An optional set of override options to apply to the selected build variant.
857
+ *
858
+ * @remarks
859
+ * 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.
860
+ */
861
+ override?: Partial<TBuildResolvedConfig>;
801
862
  };
802
- override?: Partial<TBuildResolvedConfig>;
803
863
  };
804
864
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
805
865
  /**
@@ -822,7 +882,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
822
882
  */
823
883
  output?: string;
824
884
  }
825
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
885
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
826
886
  /**
827
887
  * The name of the environment
828
888
  */
@@ -839,7 +899,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
839
899
  /**
840
900
  * The resolved options for the Powerlines project configuration.
841
901
  */
842
- 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">> & {
902
+ 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">> & {
843
903
  /**
844
904
  * The configuration options that were provided inline to the Powerlines CLI.
845
905
  */
@@ -870,6 +930,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
870
930
  * The output configuration options to use for the build process
871
931
  */
872
932
  output: OutputResolvedConfig;
933
+ /**
934
+ * Configuration provided to build processes
935
+ *
936
+ * @remarks
937
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
938
+ */
939
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
873
940
  /**
874
941
  * The log level to use for the Powerlines processes.
875
942
  *
@@ -923,7 +990,13 @@ interface InitContextOptions {
923
990
  */
924
991
  isHighPriority: boolean;
925
992
  }
926
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
993
+ /**
994
+ * The unresolved Powerlines context.
995
+ *
996
+ * @remarks
997
+ * This context is used before the user configuration has been fully resolved after the `config`.
998
+ */
999
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
927
1000
  /**
928
1001
  * The Storm workspace configuration
929
1002
  */
@@ -931,7 +1004,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
931
1004
  /**
932
1005
  * An object containing the options provided to Powerlines
933
1006
  */
934
- config: TResolvedConfig;
1007
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1008
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1009
+ output: TResolvedConfig["output"];
1010
+ };
935
1011
  /**
936
1012
  * A logging function for the Powerlines engine
937
1013
  */
@@ -1088,6 +1164,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1088
1164
  */
1089
1165
  extendLog: (name: string) => LogFn;
1090
1166
  }
1167
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1168
+ /**
1169
+ * The fully resolved Powerlines configuration
1170
+ */
1171
+ config: TResolvedConfig;
1172
+ };
1091
1173
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1092
1174
  /**
1093
1175
  * The environment specific resolved configuration
@@ -1128,6 +1210,10 @@ interface GenerateTypesResult {
1128
1210
  directives?: string[];
1129
1211
  code: string;
1130
1212
  }
1213
+ type DeepPartial<T> = {
1214
+ [K in keyof T]?: DeepPartial<T[K]>;
1215
+ };
1216
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1131
1217
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1132
1218
  /**
1133
1219
  * A function that returns configuration options to be merged with the build context's options.
@@ -1143,7 +1229,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1143
1229
  * @param config - The partial configuration object to be modified.
1144
1230
  * @returns A promise that resolves to a partial configuration object.
1145
1231
  */
1146
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1232
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1147
1233
  /**
1148
1234
  * 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.
1149
1235
  *
@@ -1246,7 +1332,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1246
1332
  * @param config - The partial configuration object to be modified.
1247
1333
  * @returns A promise that resolves to a partial configuration object.
1248
1334
  */
1249
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1335
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1250
1336
  /**
1251
1337
  * A hook that is called to transform the source code.
1252
1338
  *
@@ -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
 
71
141
  type ReflectionMode = "default" | "explicit" | "never";
72
142
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -642,24 +712,33 @@ interface BaseConfig {
642
712
  * The entry point(s) for the application
643
713
  */
644
714
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
715
+ /**
716
+ * Configuration for the output of the build process
717
+ */
718
+ output?: OutputConfig;
645
719
  /**
646
720
  * Configuration for linting the source code
721
+ *
722
+ * @remarks
723
+ * If set to `false`, linting will be disabled.
647
724
  */
648
725
  lint?: Record<string, any> | false;
649
726
  /**
650
727
  * Configuration for testing the source code
728
+ *
729
+ * @remarks
730
+ * If set to `false`, testing will be disabled.
651
731
  */
652
732
  test?: Record<string, any> | false;
653
- /**
654
- * Configuration for the output of the build process
655
- */
656
- output?: OutputConfig;
657
733
  /**
658
734
  * Configuration for the transformation of the source code
659
735
  */
660
736
  transform?: Record<string, any>;
661
737
  /**
662
- * Options to to provide to the build process
738
+ * Configuration provided to build processes
739
+ *
740
+ * @remarks
741
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
663
742
  */
664
743
  build?: BuildConfig;
665
744
  /**
@@ -689,37 +768,6 @@ interface BaseConfig {
689
768
  tsconfigRaw?: TSConfig;
690
769
  }
691
770
  interface EnvironmentConfig extends BaseConfig {
692
- /**
693
- * 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.
694
- *
695
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
696
- */
697
- mainFields?: string[];
698
- /**
699
- * Array of strings indicating what conditions should be used for module resolution.
700
- */
701
- conditions?: string[];
702
- /**
703
- * Array of strings indicating what conditions should be used for external modules.
704
- */
705
- externalConditions?: string[];
706
- /**
707
- * Array of strings indicating what file extensions should be used for module resolution.
708
- *
709
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
710
- */
711
- extensions?: string[];
712
- /**
713
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
714
- *
715
- * @remarks
716
- * 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.
717
- */
718
- dedupe?: string[];
719
- /**
720
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
721
- */
722
- builtins?: (string | RegExp)[];
723
771
  /**
724
772
  * Configuration options for the preview server
725
773
  */
@@ -792,14 +840,26 @@ interface CommonUserConfig extends BaseConfig {
792
840
  */
793
841
  framework?: string;
794
842
  }
795
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
796
- build?: TBuildConfig & {
843
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
844
+ /**
845
+ * Configuration provided to build processes
846
+ *
847
+ * @remarks
848
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
849
+ */
850
+ build: Omit<TBuildConfig, "override"> & {
797
851
  /**
798
852
  * The build variant being used by the Powerlines engine.
799
853
  */
800
854
  variant?: TBuildVariant;
855
+ /**
856
+ * An optional set of override options to apply to the selected build variant.
857
+ *
858
+ * @remarks
859
+ * 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.
860
+ */
861
+ override?: Partial<TBuildResolvedConfig>;
801
862
  };
802
- override?: Partial<TBuildResolvedConfig>;
803
863
  };
804
864
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
805
865
  /**
@@ -822,7 +882,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
822
882
  */
823
883
  output?: string;
824
884
  }
825
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
885
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
826
886
  /**
827
887
  * The name of the environment
828
888
  */
@@ -839,7 +899,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
839
899
  /**
840
900
  * The resolved options for the Powerlines project configuration.
841
901
  */
842
- 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">> & {
902
+ 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">> & {
843
903
  /**
844
904
  * The configuration options that were provided inline to the Powerlines CLI.
845
905
  */
@@ -870,6 +930,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
870
930
  * The output configuration options to use for the build process
871
931
  */
872
932
  output: OutputResolvedConfig;
933
+ /**
934
+ * Configuration provided to build processes
935
+ *
936
+ * @remarks
937
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
938
+ */
939
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
873
940
  /**
874
941
  * The log level to use for the Powerlines processes.
875
942
  *
@@ -923,7 +990,13 @@ interface InitContextOptions {
923
990
  */
924
991
  isHighPriority: boolean;
925
992
  }
926
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
993
+ /**
994
+ * The unresolved Powerlines context.
995
+ *
996
+ * @remarks
997
+ * This context is used before the user configuration has been fully resolved after the `config`.
998
+ */
999
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
927
1000
  /**
928
1001
  * The Storm workspace configuration
929
1002
  */
@@ -931,7 +1004,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
931
1004
  /**
932
1005
  * An object containing the options provided to Powerlines
933
1006
  */
934
- config: TResolvedConfig;
1007
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1008
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1009
+ output: TResolvedConfig["output"];
1010
+ };
935
1011
  /**
936
1012
  * A logging function for the Powerlines engine
937
1013
  */
@@ -1088,6 +1164,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1088
1164
  */
1089
1165
  extendLog: (name: string) => LogFn;
1090
1166
  }
1167
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1168
+ /**
1169
+ * The fully resolved Powerlines configuration
1170
+ */
1171
+ config: TResolvedConfig;
1172
+ };
1091
1173
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1092
1174
  /**
1093
1175
  * The environment specific resolved configuration
@@ -1128,6 +1210,10 @@ interface GenerateTypesResult {
1128
1210
  directives?: string[];
1129
1211
  code: string;
1130
1212
  }
1213
+ type DeepPartial<T> = {
1214
+ [K in keyof T]?: DeepPartial<T[K]>;
1215
+ };
1216
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1131
1217
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1132
1218
  /**
1133
1219
  * A function that returns configuration options to be merged with the build context's options.
@@ -1143,7 +1229,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1143
1229
  * @param config - The partial configuration object to be modified.
1144
1230
  * @returns A promise that resolves to a partial configuration object.
1145
1231
  */
1146
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1232
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1147
1233
  /**
1148
1234
  * 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.
1149
1235
  *
@@ -1246,7 +1332,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1246
1332
  * @param config - The partial configuration object to be modified.
1247
1333
  * @returns A promise that resolves to a partial configuration object.
1248
1334
  */
1249
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1335
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1250
1336
  /**
1251
1337
  * A hook that is called to transform the source code.
1252
1338
  *
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IdPluginOptions, P as Plugin, a as IdPluginContext } from './index-UhS6IjOH.cjs';
2
- export { c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from './index-UhS6IjOH.cjs';
1
+ import { I as IdPluginOptions, P as Plugin, a as IdPluginContext } from './index-BLWbGMpG.cjs';
2
+ export { c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from './index-BLWbGMpG.cjs';
3
3
  export { nanoidModule } from './components/nanoid.cjs';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { I as IdPluginOptions, P as Plugin, a as IdPluginContext } from './index-UhS6IjOH.js';
2
- export { c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from './index-UhS6IjOH.js';
1
+ import { I as IdPluginOptions, P as Plugin, a as IdPluginContext } from './index-BLWbGMpG.js';
2
+ export { c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from './index-BLWbGMpG.js';
3
3
  export { nanoidModule } from './components/nanoid.js';
4
4
  import '@storm-software/build-tools/types';
5
5
  import '@storm-software/config-tools/types';
@@ -1,4 +1,4 @@
1
- export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-UhS6IjOH.cjs';
1
+ export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-BLWbGMpG.cjs';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -1,4 +1,4 @@
1
- export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-UhS6IjOH.js';
1
+ export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-BLWbGMpG.js';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -1,4 +1,4 @@
1
- export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-UhS6IjOH.cjs';
1
+ export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-BLWbGMpG.cjs';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -1,4 +1,4 @@
1
- export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-UhS6IjOH.js';
1
+ export { a as IdPluginContext, I as IdPluginOptions, c as IdPluginResolvedConfig, b as IdPluginUserConfig, U as UniqueIdFormatType } from '../index-BLWbGMpG.js';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-id",
3
- "version": "0.9.17",
3
+ "version": "0.9.18",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin that provides unique identifier generation capabilities at runtime by adding the `id` builtin module.",
6
6
  "repository": {
@@ -119,13 +119,13 @@
119
119
  "@storm-software/config-tools": "^1.188.40",
120
120
  "@stryke/path": "^0.19.2",
121
121
  "defu": "^6.1.4",
122
- "powerlines": "^0.19.5"
122
+ "powerlines": "^0.20.0"
123
123
  },
124
124
  "devDependencies": {
125
- "@powerlines/nx": "^0.10.9",
125
+ "@powerlines/nx": "^0.10.10",
126
126
  "@storm-software/tsup": "^0.2.38",
127
127
  "@types/node": "^22.19.1"
128
128
  },
129
129
  "publishConfig": { "access": "public" },
130
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
130
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
131
131
  }