@powerlines/plugin-crypto 0.9.17 → 0.9.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,4 +1,4 @@
1
- import { a as CryptoPluginContext } from '../index-D1pYRpOZ.cjs';
1
+ import { a as CryptoPluginContext } from '../index-B6n1aAYK.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -1,4 +1,4 @@
1
- import { a as CryptoPluginContext } from '../index-D1pYRpOZ.js';
1
+ import { a as CryptoPluginContext } from '../index-B6n1aAYK.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -1,5 +1,5 @@
1
1
  export { cryptoModule } from './crypto.cjs';
2
- import '../index-D1pYRpOZ.cjs';
2
+ import '../index-B6n1aAYK.cjs';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -1,5 +1,5 @@
1
1
  export { cryptoModule } from './crypto.js';
2
- import '../index-D1pYRpOZ.js';
2
+ import '../index-B6n1aAYK.js';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -15,7 +15,7 @@ import { PackageJson } from '@stryke/types/package-json';
15
15
  import { Jiti } from 'jiti';
16
16
  import { ParserOptions, ParseResult } from 'oxc-parser';
17
17
  import { Range } from 'semver';
18
- import { UnpluginContext, UnpluginBuildContext, UnpluginMessage, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
18
+ import { UnpluginContext, UnpluginMessage, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
19
19
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
20
  import ts from 'typescript';
21
21
  import { PrimitiveJsonValue } from '@stryke/json/types';
@@ -33,6 +33,73 @@ interface BuildConfig {
33
33
  * @defaultValue "neutral"
34
34
  */
35
35
  platform?: "node" | "browser" | "neutral";
36
+ /**
37
+ * 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.
38
+ *
39
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
40
+ */
41
+ mainFields?: string[];
42
+ /**
43
+ * Array of strings indicating what conditions should be used for module resolution.
44
+ */
45
+ conditions?: string[];
46
+ /**
47
+ * Array of strings indicating what file extensions should be used for module resolution.
48
+ *
49
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
50
+ */
51
+ extensions?: string[];
52
+ /**
53
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
54
+ *
55
+ * @remarks
56
+ * 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.
57
+ */
58
+ dedupe?: string[];
59
+ /**
60
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
61
+ */
62
+ builtins?: (string | RegExp)[];
63
+ /**
64
+ * Define global variable replacements.
65
+ *
66
+ * @remarks
67
+ * 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.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * {
72
+ * define: {
73
+ * __VERSION__: '"1.0.0"',
74
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
75
+ * }
76
+ * }
77
+ * ```
78
+ *
79
+ * @see https://esbuild.github.io/api/#define
80
+ * @see https://vitejs.dev/config/build-options.html#define
81
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
82
+ */
83
+ define?: Record<string, any>;
84
+ /**
85
+ * Global variables that will have import statements injected where necessary
86
+ *
87
+ * @remarks
88
+ * 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.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * {
93
+ * inject: {
94
+ * process: 'process/browser',
95
+ * Buffer: ['buffer', 'Buffer'],
96
+ * }
97
+ * }
98
+ * ```
99
+ *
100
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
101
+ */
102
+ inject?: Record<string, string | string[]>;
36
103
  /**
37
104
  * The alias mappings to use for module resolution during the build process.
38
105
  *
@@ -48,6 +115,8 @@ interface BuildConfig {
48
115
  * }
49
116
  * }
50
117
  * ```
118
+ *
119
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
51
120
  */
52
121
  alias?: Record<string, string>;
53
122
  /**
@@ -66,13 +135,14 @@ interface BuildConfig {
66
135
  */
67
136
  skipNodeModulesBundle?: boolean;
68
137
  /**
69
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
138
+ * An optional set of override options to apply to the selected build variant.
70
139
  *
71
- * @defaultValue false
140
+ * @remarks
141
+ * 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.
72
142
  */
73
- skipPrepare?: boolean;
143
+ override?: Record<string, any>;
74
144
  }
75
- type BuildResolvedConfig = BuildConfig;
145
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
76
146
 
77
147
  type BabelPluginPass<TState = unknown> = PluginPass & TState;
78
148
  type BabelTransformPluginFilter = (code: string, id: string) => boolean;
@@ -676,24 +746,33 @@ interface BaseConfig {
676
746
  * The entry point(s) for the application
677
747
  */
678
748
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
749
+ /**
750
+ * Configuration for the output of the build process
751
+ */
752
+ output?: OutputConfig;
679
753
  /**
680
754
  * Configuration for linting the source code
755
+ *
756
+ * @remarks
757
+ * If set to `false`, linting will be disabled.
681
758
  */
682
759
  lint?: Record<string, any> | false;
683
760
  /**
684
761
  * Configuration for testing the source code
762
+ *
763
+ * @remarks
764
+ * If set to `false`, testing will be disabled.
685
765
  */
686
766
  test?: Record<string, any> | false;
687
- /**
688
- * Configuration for the output of the build process
689
- */
690
- output?: OutputConfig;
691
767
  /**
692
768
  * Configuration for the transformation of the source code
693
769
  */
694
770
  transform?: Record<string, any>;
695
771
  /**
696
- * Options to to provide to the build process
772
+ * Configuration provided to build processes
773
+ *
774
+ * @remarks
775
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
697
776
  */
698
777
  build?: BuildConfig;
699
778
  /**
@@ -723,37 +802,6 @@ interface BaseConfig {
723
802
  tsconfigRaw?: TSConfig;
724
803
  }
725
804
  interface EnvironmentConfig extends BaseConfig {
726
- /**
727
- * 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.
728
- *
729
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
730
- */
731
- mainFields?: string[];
732
- /**
733
- * Array of strings indicating what conditions should be used for module resolution.
734
- */
735
- conditions?: string[];
736
- /**
737
- * Array of strings indicating what conditions should be used for external modules.
738
- */
739
- externalConditions?: string[];
740
- /**
741
- * Array of strings indicating what file extensions should be used for module resolution.
742
- *
743
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
744
- */
745
- extensions?: string[];
746
- /**
747
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
748
- *
749
- * @remarks
750
- * 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.
751
- */
752
- dedupe?: string[];
753
- /**
754
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
755
- */
756
- builtins?: (string | RegExp)[];
757
805
  /**
758
806
  * Configuration options for the preview server
759
807
  */
@@ -826,14 +874,26 @@ interface CommonUserConfig extends BaseConfig {
826
874
  */
827
875
  framework?: string;
828
876
  }
829
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
830
- build?: TBuildConfig & {
877
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
878
+ /**
879
+ * Configuration provided to build processes
880
+ *
881
+ * @remarks
882
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
883
+ */
884
+ build: Omit<TBuildConfig, "override"> & {
831
885
  /**
832
886
  * The build variant being used by the Powerlines engine.
833
887
  */
834
888
  variant?: TBuildVariant;
889
+ /**
890
+ * An optional set of override options to apply to the selected build variant.
891
+ *
892
+ * @remarks
893
+ * 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.
894
+ */
895
+ override?: Partial<TBuildResolvedConfig>;
835
896
  };
836
- override?: Partial<TBuildResolvedConfig>;
837
897
  };
838
898
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
839
899
  /**
@@ -857,7 +917,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
857
917
  output?: string;
858
918
  }
859
919
  type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
860
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
920
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
861
921
  /**
862
922
  * The name of the environment
863
923
  */
@@ -874,7 +934,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
874
934
  /**
875
935
  * The resolved options for the Powerlines project configuration.
876
936
  */
877
- 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">> & {
937
+ 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">> & {
878
938
  /**
879
939
  * The configuration options that were provided inline to the Powerlines CLI.
880
940
  */
@@ -905,6 +965,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
905
965
  * The output configuration options to use for the build process
906
966
  */
907
967
  output: OutputResolvedConfig;
968
+ /**
969
+ * Configuration provided to build processes
970
+ *
971
+ * @remarks
972
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
973
+ */
974
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
908
975
  /**
909
976
  * The log level to use for the Powerlines processes.
910
977
  *
@@ -969,7 +1036,13 @@ interface InitContextOptions {
969
1036
  */
970
1037
  isHighPriority: boolean;
971
1038
  }
972
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1039
+ /**
1040
+ * The unresolved Powerlines context.
1041
+ *
1042
+ * @remarks
1043
+ * This context is used before the user configuration has been fully resolved after the `config`.
1044
+ */
1045
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
973
1046
  /**
974
1047
  * The Storm workspace configuration
975
1048
  */
@@ -977,7 +1050,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
977
1050
  /**
978
1051
  * An object containing the options provided to Powerlines
979
1052
  */
980
- config: TResolvedConfig;
1053
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1054
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1055
+ output: TResolvedConfig["output"];
1056
+ };
981
1057
  /**
982
1058
  * A logging function for the Powerlines engine
983
1059
  */
@@ -1134,6 +1210,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1134
1210
  */
1135
1211
  extendLog: (name: string) => LogFn;
1136
1212
  }
1213
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1214
+ /**
1215
+ * The fully resolved Powerlines configuration
1216
+ */
1217
+ config: TResolvedConfig;
1218
+ };
1137
1219
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1138
1220
  /**
1139
1221
  * The environment specific resolved configuration
@@ -1174,6 +1256,10 @@ interface GenerateTypesResult {
1174
1256
  directives?: string[];
1175
1257
  code: string;
1176
1258
  }
1259
+ type DeepPartial<T> = {
1260
+ [K in keyof T]?: DeepPartial<T[K]>;
1261
+ };
1262
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1177
1263
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1178
1264
  /**
1179
1265
  * A function that returns configuration options to be merged with the build context's options.
@@ -1189,7 +1275,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1189
1275
  * @param config - The partial configuration object to be modified.
1190
1276
  * @returns A promise that resolves to a partial configuration object.
1191
1277
  */
1192
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1278
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1193
1279
  /**
1194
1280
  * 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.
1195
1281
  *
@@ -1292,7 +1378,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1292
1378
  * @param config - The partial configuration object to be modified.
1293
1379
  * @returns A promise that resolves to a partial configuration object.
1294
1380
  */
1295
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1381
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1296
1382
  /**
1297
1383
  * A hook that is called to transform the source code.
1298
1384
  *
@@ -15,7 +15,7 @@ import { PackageJson } from '@stryke/types/package-json';
15
15
  import { Jiti } from 'jiti';
16
16
  import { ParserOptions, ParseResult } from 'oxc-parser';
17
17
  import { Range } from 'semver';
18
- import { UnpluginContext, UnpluginBuildContext, UnpluginMessage, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
18
+ import { UnpluginContext, UnpluginMessage, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
19
19
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
20
  import ts from 'typescript';
21
21
  import { PrimitiveJsonValue } from '@stryke/json/types';
@@ -33,6 +33,73 @@ interface BuildConfig {
33
33
  * @defaultValue "neutral"
34
34
  */
35
35
  platform?: "node" | "browser" | "neutral";
36
+ /**
37
+ * 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.
38
+ *
39
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
40
+ */
41
+ mainFields?: string[];
42
+ /**
43
+ * Array of strings indicating what conditions should be used for module resolution.
44
+ */
45
+ conditions?: string[];
46
+ /**
47
+ * Array of strings indicating what file extensions should be used for module resolution.
48
+ *
49
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
50
+ */
51
+ extensions?: string[];
52
+ /**
53
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
54
+ *
55
+ * @remarks
56
+ * 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.
57
+ */
58
+ dedupe?: string[];
59
+ /**
60
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
61
+ */
62
+ builtins?: (string | RegExp)[];
63
+ /**
64
+ * Define global variable replacements.
65
+ *
66
+ * @remarks
67
+ * 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.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * {
72
+ * define: {
73
+ * __VERSION__: '"1.0.0"',
74
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
75
+ * }
76
+ * }
77
+ * ```
78
+ *
79
+ * @see https://esbuild.github.io/api/#define
80
+ * @see https://vitejs.dev/config/build-options.html#define
81
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
82
+ */
83
+ define?: Record<string, any>;
84
+ /**
85
+ * Global variables that will have import statements injected where necessary
86
+ *
87
+ * @remarks
88
+ * 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.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * {
93
+ * inject: {
94
+ * process: 'process/browser',
95
+ * Buffer: ['buffer', 'Buffer'],
96
+ * }
97
+ * }
98
+ * ```
99
+ *
100
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
101
+ */
102
+ inject?: Record<string, string | string[]>;
36
103
  /**
37
104
  * The alias mappings to use for module resolution during the build process.
38
105
  *
@@ -48,6 +115,8 @@ interface BuildConfig {
48
115
  * }
49
116
  * }
50
117
  * ```
118
+ *
119
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
51
120
  */
52
121
  alias?: Record<string, string>;
53
122
  /**
@@ -66,13 +135,14 @@ interface BuildConfig {
66
135
  */
67
136
  skipNodeModulesBundle?: boolean;
68
137
  /**
69
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
138
+ * An optional set of override options to apply to the selected build variant.
70
139
  *
71
- * @defaultValue false
140
+ * @remarks
141
+ * 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.
72
142
  */
73
- skipPrepare?: boolean;
143
+ override?: Record<string, any>;
74
144
  }
75
- type BuildResolvedConfig = BuildConfig;
145
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
76
146
 
77
147
  type BabelPluginPass<TState = unknown> = PluginPass & TState;
78
148
  type BabelTransformPluginFilter = (code: string, id: string) => boolean;
@@ -676,24 +746,33 @@ interface BaseConfig {
676
746
  * The entry point(s) for the application
677
747
  */
678
748
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
749
+ /**
750
+ * Configuration for the output of the build process
751
+ */
752
+ output?: OutputConfig;
679
753
  /**
680
754
  * Configuration for linting the source code
755
+ *
756
+ * @remarks
757
+ * If set to `false`, linting will be disabled.
681
758
  */
682
759
  lint?: Record<string, any> | false;
683
760
  /**
684
761
  * Configuration for testing the source code
762
+ *
763
+ * @remarks
764
+ * If set to `false`, testing will be disabled.
685
765
  */
686
766
  test?: Record<string, any> | false;
687
- /**
688
- * Configuration for the output of the build process
689
- */
690
- output?: OutputConfig;
691
767
  /**
692
768
  * Configuration for the transformation of the source code
693
769
  */
694
770
  transform?: Record<string, any>;
695
771
  /**
696
- * Options to to provide to the build process
772
+ * Configuration provided to build processes
773
+ *
774
+ * @remarks
775
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
697
776
  */
698
777
  build?: BuildConfig;
699
778
  /**
@@ -723,37 +802,6 @@ interface BaseConfig {
723
802
  tsconfigRaw?: TSConfig;
724
803
  }
725
804
  interface EnvironmentConfig extends BaseConfig {
726
- /**
727
- * 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.
728
- *
729
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
730
- */
731
- mainFields?: string[];
732
- /**
733
- * Array of strings indicating what conditions should be used for module resolution.
734
- */
735
- conditions?: string[];
736
- /**
737
- * Array of strings indicating what conditions should be used for external modules.
738
- */
739
- externalConditions?: string[];
740
- /**
741
- * Array of strings indicating what file extensions should be used for module resolution.
742
- *
743
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
744
- */
745
- extensions?: string[];
746
- /**
747
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
748
- *
749
- * @remarks
750
- * 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.
751
- */
752
- dedupe?: string[];
753
- /**
754
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
755
- */
756
- builtins?: (string | RegExp)[];
757
805
  /**
758
806
  * Configuration options for the preview server
759
807
  */
@@ -826,14 +874,26 @@ interface CommonUserConfig extends BaseConfig {
826
874
  */
827
875
  framework?: string;
828
876
  }
829
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
830
- build?: TBuildConfig & {
877
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
878
+ /**
879
+ * Configuration provided to build processes
880
+ *
881
+ * @remarks
882
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
883
+ */
884
+ build: Omit<TBuildConfig, "override"> & {
831
885
  /**
832
886
  * The build variant being used by the Powerlines engine.
833
887
  */
834
888
  variant?: TBuildVariant;
889
+ /**
890
+ * An optional set of override options to apply to the selected build variant.
891
+ *
892
+ * @remarks
893
+ * 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.
894
+ */
895
+ override?: Partial<TBuildResolvedConfig>;
835
896
  };
836
- override?: Partial<TBuildResolvedConfig>;
837
897
  };
838
898
  type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
839
899
  /**
@@ -857,7 +917,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
857
917
  output?: string;
858
918
  }
859
919
  type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
860
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
920
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
861
921
  /**
862
922
  * The name of the environment
863
923
  */
@@ -874,7 +934,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
874
934
  /**
875
935
  * The resolved options for the Powerlines project configuration.
876
936
  */
877
- 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">> & {
937
+ 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">> & {
878
938
  /**
879
939
  * The configuration options that were provided inline to the Powerlines CLI.
880
940
  */
@@ -905,6 +965,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
905
965
  * The output configuration options to use for the build process
906
966
  */
907
967
  output: OutputResolvedConfig;
968
+ /**
969
+ * Configuration provided to build processes
970
+ *
971
+ * @remarks
972
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
973
+ */
974
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
908
975
  /**
909
976
  * The log level to use for the Powerlines processes.
910
977
  *
@@ -969,7 +1036,13 @@ interface InitContextOptions {
969
1036
  */
970
1037
  isHighPriority: boolean;
971
1038
  }
972
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1039
+ /**
1040
+ * The unresolved Powerlines context.
1041
+ *
1042
+ * @remarks
1043
+ * This context is used before the user configuration has been fully resolved after the `config`.
1044
+ */
1045
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
973
1046
  /**
974
1047
  * The Storm workspace configuration
975
1048
  */
@@ -977,7 +1050,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
977
1050
  /**
978
1051
  * An object containing the options provided to Powerlines
979
1052
  */
980
- config: TResolvedConfig;
1053
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1054
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1055
+ output: TResolvedConfig["output"];
1056
+ };
981
1057
  /**
982
1058
  * A logging function for the Powerlines engine
983
1059
  */
@@ -1134,6 +1210,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1134
1210
  */
1135
1211
  extendLog: (name: string) => LogFn;
1136
1212
  }
1213
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1214
+ /**
1215
+ * The fully resolved Powerlines configuration
1216
+ */
1217
+ config: TResolvedConfig;
1218
+ };
1137
1219
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1138
1220
  /**
1139
1221
  * The environment specific resolved configuration
@@ -1174,6 +1256,10 @@ interface GenerateTypesResult {
1174
1256
  directives?: string[];
1175
1257
  code: string;
1176
1258
  }
1259
+ type DeepPartial<T> = {
1260
+ [K in keyof T]?: DeepPartial<T[K]>;
1261
+ };
1262
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1177
1263
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1178
1264
  /**
1179
1265
  * A function that returns configuration options to be merged with the build context's options.
@@ -1189,7 +1275,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1189
1275
  * @param config - The partial configuration object to be modified.
1190
1276
  * @returns A promise that resolves to a partial configuration object.
1191
1277
  */
1192
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1278
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1193
1279
  /**
1194
1280
  * 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.
1195
1281
  *
@@ -1292,7 +1378,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1292
1378
  * @param config - The partial configuration object to be modified.
1293
1379
  * @returns A promise that resolves to a partial configuration object.
1294
1380
  */
1295
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1381
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1296
1382
  /**
1297
1383
  * A hook that is called to transform the source code.
1298
1384
  *
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-D1pYRpOZ.cjs';
2
- export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from './index-D1pYRpOZ.cjs';
1
+ import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-B6n1aAYK.cjs';
2
+ export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from './index-B6n1aAYK.cjs';
3
3
  export { cryptoModule } from './components/crypto.cjs';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@deepkit/type';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-D1pYRpOZ.js';
2
- export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from './index-D1pYRpOZ.js';
1
+ import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-B6n1aAYK.js';
2
+ export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from './index-B6n1aAYK.js';
3
3
  export { cryptoModule } from './components/crypto.js';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@deepkit/type';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-D1pYRpOZ.cjs';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-B6n1aAYK.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-D1pYRpOZ.js';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-B6n1aAYK.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-D1pYRpOZ.cjs';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-B6n1aAYK.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-D1pYRpOZ.js';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig } from '../index-B6n1aAYK.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-crypto",
3
- "version": "0.9.17",
3
+ "version": "0.9.19",
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": {
@@ -116,17 +116,17 @@
116
116
  "files": ["dist/**/*"],
117
117
  "keywords": ["powerlines", "storm-software", "powerlines-plugin"],
118
118
  "dependencies": {
119
- "@powerlines/plugin-env": "^0.13.14",
120
- "@storm-software/config-tools": "^1.188.38",
119
+ "@powerlines/plugin-env": "^0.13.16",
120
+ "@storm-software/config-tools": "^1.188.40",
121
121
  "@stryke/path": "^0.19.2",
122
122
  "defu": "^6.1.4",
123
- "powerlines": "^0.19.4"
123
+ "powerlines": "^0.20.0"
124
124
  },
125
125
  "devDependencies": {
126
- "@powerlines/nx": "^0.10.8",
127
- "@storm-software/tsup": "^0.2.36",
126
+ "@powerlines/nx": "^0.10.10",
127
+ "@storm-software/tsup": "^0.2.38",
128
128
  "@types/node": "^22.19.1"
129
129
  },
130
130
  "publishConfig": { "access": "public" },
131
- "gitHead": "ab4911e45335c3ac4d162831f770181585c0d26f"
131
+ "gitHead": "e33924ab31dbf508b8983523edbaecffeebbee4f"
132
132
  }