@powerlines/plugin-biome 0.2.14 → 0.2.16

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.
@@ -14,9 +14,7 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
14
14
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
15
15
  import ts from 'typescript';
16
16
  import { PrimitiveJsonValue } from '@stryke/json/types';
17
- import { Volume } from 'memfs';
18
17
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
19
- import { IUnionFs } from 'unionfs';
20
18
  import { ArrayValues } from '@stryke/types/array';
21
19
 
22
20
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
@@ -27,6 +25,87 @@ interface BuildConfig {
27
25
  * @defaultValue "neutral"
28
26
  */
29
27
  platform?: "node" | "browser" | "neutral";
28
+ /**
29
+ * Array of strings indicating the polyfills to include for the build.
30
+ *
31
+ * @remarks
32
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * {
37
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
38
+ * }
39
+ * ```
40
+ */
41
+ polyfill?: string[];
42
+ /**
43
+ * 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.
44
+ *
45
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
46
+ */
47
+ mainFields?: string[];
48
+ /**
49
+ * Array of strings indicating what conditions should be used for module resolution.
50
+ */
51
+ conditions?: string[];
52
+ /**
53
+ * Array of strings indicating what file extensions should be used for module resolution.
54
+ *
55
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
56
+ */
57
+ extensions?: string[];
58
+ /**
59
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
60
+ *
61
+ * @remarks
62
+ * 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.
63
+ */
64
+ dedupe?: string[];
65
+ /**
66
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
67
+ */
68
+ builtins?: (string | RegExp)[];
69
+ /**
70
+ * Define global variable replacements.
71
+ *
72
+ * @remarks
73
+ * 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.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * {
78
+ * define: {
79
+ * __VERSION__: '"1.0.0"',
80
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
81
+ * }
82
+ * }
83
+ * ```
84
+ *
85
+ * @see https://esbuild.github.io/api/#define
86
+ * @see https://vitejs.dev/config/build-options.html#define
87
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
88
+ */
89
+ define?: Record<string, any>;
90
+ /**
91
+ * Global variables that will have import statements injected where necessary
92
+ *
93
+ * @remarks
94
+ * 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.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * {
99
+ * inject: {
100
+ * process: 'process/browser',
101
+ * Buffer: ['buffer', 'Buffer'],
102
+ * }
103
+ * }
104
+ * ```
105
+ *
106
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
107
+ */
108
+ inject?: Record<string, string | string[]>;
30
109
  /**
31
110
  * The alias mappings to use for module resolution during the build process.
32
111
  *
@@ -42,8 +121,13 @@ interface BuildConfig {
42
121
  * }
43
122
  * }
44
123
  * ```
124
+ *
125
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
45
126
  */
46
- alias?: Record<string, string>;
127
+ alias?: Record<string, string> | Array<{
128
+ find: string | RegExp;
129
+ replacement: string;
130
+ }>;
47
131
  /**
48
132
  * A list of modules that should not be bundled, even if they are external dependencies.
49
133
  *
@@ -60,13 +144,14 @@ interface BuildConfig {
60
144
  */
61
145
  skipNodeModulesBundle?: boolean;
62
146
  /**
63
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
147
+ * An optional set of override options to apply to the selected build variant.
64
148
  *
65
- * @defaultValue false
149
+ * @remarks
150
+ * 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
151
  */
67
- skipPrepare?: boolean;
152
+ override?: Record<string, any>;
68
153
  }
69
- type BuildResolvedConfig = BuildConfig;
154
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
70
155
 
71
156
  type ReflectionMode = "default" | "explicit" | "never";
72
157
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -132,11 +217,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
132
217
  tsconfigFilePath: string;
133
218
  };
134
219
 
135
- declare const __VFS_INIT__ = "__VFS_INIT__";
136
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
137
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
138
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
139
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
220
+ declare const __VFS_PATCH__: unique symbol;
221
+ declare const __VFS_REVERT__: unique symbol;
140
222
  type OutputModeType = "fs" | "virtual";
141
223
  interface VirtualFile {
142
224
  /**
@@ -176,7 +258,24 @@ interface VirtualFile {
176
258
  */
177
259
  code: string | NodeJS.ArrayBufferView;
178
260
  }
179
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
261
+ interface VirtualFileMetadata {
262
+ /**
263
+ * The identifier for the file data.
264
+ */
265
+ id: string;
266
+ /**
267
+ * The variant of the file.
268
+ */
269
+ variant: string;
270
+ /**
271
+ * The output mode of the file.
272
+ */
273
+ mode: string;
274
+ /**
275
+ * Additional metadata associated with the file.
276
+ */
277
+ properties: Record<string, string>;
278
+ }
180
279
  interface ResolveFSOptions {
181
280
  mode?: OutputModeType;
182
281
  }
@@ -205,12 +304,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
205
304
  type?: "file" | "directory";
206
305
  }
207
306
  interface VirtualFileSystemInterface {
208
- [__VFS_INIT__]: () => void;
307
+ /**
308
+ * Patches the File System to include the virtual file system (VFS) contents.
309
+ */
310
+ [__VFS_PATCH__]: () => void;
311
+ /**
312
+ * Reverts the virtual file system (VFS) to its previous state.
313
+ */
209
314
  [__VFS_REVERT__]: () => void;
210
315
  /**
211
316
  * The underlying file metadata.
212
317
  */
213
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
318
+ metadata: Record<string, VirtualFileMetadata | undefined>;
214
319
  /**
215
320
  * A map of module ids to their file paths.
216
321
  */
@@ -230,7 +335,7 @@ interface VirtualFileSystemInterface {
230
335
  * @param options - Optional parameters for resolving the path.
231
336
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
232
337
  */
233
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
338
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
234
339
  /**
235
340
  * Checks if a file exists in the virtual file system (VFS).
236
341
  *
@@ -245,15 +350,6 @@ interface VirtualFileSystemInterface {
245
350
  * @returns `true` if the directory exists, otherwise `false`.
246
351
  */
247
352
  isDirectory: (path: string) => boolean;
248
- /**
249
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
250
- *
251
- * @see https://www.typescriptlang.org/tsconfig#paths
252
- *
253
- * @param pathOrId - The path or id to check.
254
- * @returns Whether the path or id corresponds to a virtual file.
255
- */
256
- isTsconfigPath: (pathOrId: string) => boolean;
257
353
  /**
258
354
  * Checks if a file exists in the virtual file system (VFS).
259
355
  *
@@ -267,7 +363,7 @@ interface VirtualFileSystemInterface {
267
363
  * @param pathOrId - The path or id of the file.
268
364
  * @returns The metadata of the file if it exists, otherwise undefined.
269
365
  */
270
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
366
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
271
367
  /**
272
368
  * Gets the stats of a file in the virtual file system (VFS).
273
369
  *
@@ -475,23 +571,12 @@ interface VirtualFileSystemInterface {
475
571
  */
476
572
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
477
573
  /**
478
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
479
- *
480
- * @see https://www.typescriptlang.org/tsconfig#paths
481
- *
482
- * @param path - The path to check.
483
- * @returns The resolved file path if it exists, otherwise undefined.
484
- */
485
- resolveTsconfigPath: (path: string) => string | false;
486
- /**
487
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
488
- *
489
- * @see https://www.typescriptlang.org/tsconfig#paths
574
+ * Formats a path to match the virtual file system (VFS) structure.
490
575
  *
491
- * @param path - The path to check.
492
- * @returns The resolved package name if it exists, otherwise undefined.
576
+ * @param path - The path to format.
577
+ * @returns The formatted path.
493
578
  */
494
- resolveTsconfigPathPackage: (path: string) => string | false;
579
+ formatPath: (path: string) => string;
495
580
  /**
496
581
  * Resolves a path or id to a file path in the virtual file system.
497
582
  *
@@ -500,23 +585,9 @@ interface VirtualFileSystemInterface {
500
585
  */
501
586
  realpathSync: (pathOrId: string) => string;
502
587
  /**
503
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
504
- *
505
- * @returns A record mapping file paths to their partial metadata.
506
- */
507
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
508
- /**
509
- * A map of cached file paths to their underlying file content.
510
- */
511
- [__VFS_CACHE__]: Map<string, string>;
512
- /**
513
- * A reference to the underlying virtual file system.
588
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
514
589
  */
515
- [__VFS_VIRTUAL__]: Volume;
516
- /**
517
- * A reference to the underlying unified file system.
518
- */
519
- [__VFS_UNIFIED__]: IUnionFs;
590
+ dispose: () => Promise<void>;
520
591
  }
521
592
 
522
593
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -642,24 +713,33 @@ interface BaseConfig {
642
713
  * The entry point(s) for the application
643
714
  */
644
715
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
716
+ /**
717
+ * Configuration for the output of the build process
718
+ */
719
+ output?: OutputConfig;
645
720
  /**
646
721
  * Configuration for linting the source code
722
+ *
723
+ * @remarks
724
+ * If set to `false`, linting will be disabled.
647
725
  */
648
726
  lint?: Record<string, any> | false;
649
727
  /**
650
728
  * Configuration for testing the source code
729
+ *
730
+ * @remarks
731
+ * If set to `false`, testing will be disabled.
651
732
  */
652
733
  test?: Record<string, any> | false;
653
- /**
654
- * Configuration for the output of the build process
655
- */
656
- output?: OutputConfig;
657
734
  /**
658
735
  * Configuration for the transformation of the source code
659
736
  */
660
737
  transform?: Record<string, any>;
661
738
  /**
662
- * Options to to provide to the build process
739
+ * Configuration provided to build processes
740
+ *
741
+ * @remarks
742
+ * 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
743
  */
664
744
  build?: BuildConfig;
665
745
  /**
@@ -669,6 +749,13 @@ interface BaseConfig {
669
749
  * This configuration will be used by the documentation generation plugins during the `docs` command.
670
750
  */
671
751
  docs?: Record<string, any>;
752
+ /**
753
+ * Configuration for deploying the source code
754
+ *
755
+ * @remarks
756
+ * If set to `false`, the deployment will be disabled.
757
+ */
758
+ deploy?: Record<string, any> | false;
672
759
  /**
673
760
  * The path to the tsconfig file to be used by the compiler
674
761
  *
@@ -689,37 +776,6 @@ interface BaseConfig {
689
776
  tsconfigRaw?: TSConfig;
690
777
  }
691
778
  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
779
  /**
724
780
  * Configuration options for the preview server
725
781
  */
@@ -792,16 +848,28 @@ interface CommonUserConfig extends BaseConfig {
792
848
  */
793
849
  framework?: string;
794
850
  }
795
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
796
- build?: TBuildConfig & {
851
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
852
+ /**
853
+ * Configuration provided to build processes
854
+ *
855
+ * @remarks
856
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
857
+ */
858
+ build: Omit<TBuildConfig, "override"> & {
797
859
  /**
798
860
  * The build variant being used by the Powerlines engine.
799
861
  */
800
862
  variant?: TBuildVariant;
863
+ /**
864
+ * An optional set of override options to apply to the selected build variant.
865
+ *
866
+ * @remarks
867
+ * 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.
868
+ */
869
+ override?: Partial<TBuildResolvedConfig>;
801
870
  };
802
- override?: Partial<TBuildResolvedConfig>;
803
871
  };
804
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
872
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
805
873
  /**
806
874
  * The configuration provided while executing Powerlines commands.
807
875
  */
@@ -822,7 +890,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
822
890
  */
823
891
  output?: string;
824
892
  }
825
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
893
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
826
894
  /**
827
895
  * The name of the environment
828
896
  */
@@ -839,7 +907,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
839
907
  /**
840
908
  * The resolved options for the Powerlines project configuration.
841
909
  */
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">> & {
910
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
843
911
  /**
844
912
  * The configuration options that were provided inline to the Powerlines CLI.
845
913
  */
@@ -870,6 +938,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
870
938
  * The output configuration options to use for the build process
871
939
  */
872
940
  output: OutputResolvedConfig;
941
+ /**
942
+ * Configuration provided to build processes
943
+ *
944
+ * @remarks
945
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
946
+ */
947
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
873
948
  /**
874
949
  * The log level to use for the Powerlines processes.
875
950
  *
@@ -903,14 +978,6 @@ interface MetaInfo {
903
978
  * A hash that represents the path to the project root directory
904
979
  */
905
980
  configHash: string;
906
- /**
907
- * A mapping of runtime ids to their corresponding file paths
908
- */
909
- builtinIdMap: Record<string, string>;
910
- /**
911
- * A mapping of virtual file paths to their corresponding file contents
912
- */
913
- virtualFiles: Record<string, string | null>;
914
981
  }
915
982
  interface Resolver extends Jiti {
916
983
  plugin: Jiti;
@@ -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
@@ -1103,7 +1185,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1103
1185
  }
1104
1186
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1105
1187
 
1106
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1188
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1107
1189
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1108
1190
 
1109
1191
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -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
  *
@@ -14,9 +14,7 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
14
14
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
15
15
  import ts from 'typescript';
16
16
  import { PrimitiveJsonValue } from '@stryke/json/types';
17
- import { Volume } from 'memfs';
18
17
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
19
- import { IUnionFs } from 'unionfs';
20
18
  import { ArrayValues } from '@stryke/types/array';
21
19
 
22
20
  type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
@@ -27,6 +25,87 @@ interface BuildConfig {
27
25
  * @defaultValue "neutral"
28
26
  */
29
27
  platform?: "node" | "browser" | "neutral";
28
+ /**
29
+ * Array of strings indicating the polyfills to include for the build.
30
+ *
31
+ * @remarks
32
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * {
37
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
38
+ * }
39
+ * ```
40
+ */
41
+ polyfill?: string[];
42
+ /**
43
+ * 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.
44
+ *
45
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
46
+ */
47
+ mainFields?: string[];
48
+ /**
49
+ * Array of strings indicating what conditions should be used for module resolution.
50
+ */
51
+ conditions?: string[];
52
+ /**
53
+ * Array of strings indicating what file extensions should be used for module resolution.
54
+ *
55
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
56
+ */
57
+ extensions?: string[];
58
+ /**
59
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
60
+ *
61
+ * @remarks
62
+ * 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.
63
+ */
64
+ dedupe?: string[];
65
+ /**
66
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
67
+ */
68
+ builtins?: (string | RegExp)[];
69
+ /**
70
+ * Define global variable replacements.
71
+ *
72
+ * @remarks
73
+ * 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.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * {
78
+ * define: {
79
+ * __VERSION__: '"1.0.0"',
80
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
81
+ * }
82
+ * }
83
+ * ```
84
+ *
85
+ * @see https://esbuild.github.io/api/#define
86
+ * @see https://vitejs.dev/config/build-options.html#define
87
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
88
+ */
89
+ define?: Record<string, any>;
90
+ /**
91
+ * Global variables that will have import statements injected where necessary
92
+ *
93
+ * @remarks
94
+ * 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.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * {
99
+ * inject: {
100
+ * process: 'process/browser',
101
+ * Buffer: ['buffer', 'Buffer'],
102
+ * }
103
+ * }
104
+ * ```
105
+ *
106
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
107
+ */
108
+ inject?: Record<string, string | string[]>;
30
109
  /**
31
110
  * The alias mappings to use for module resolution during the build process.
32
111
  *
@@ -42,8 +121,13 @@ interface BuildConfig {
42
121
  * }
43
122
  * }
44
123
  * ```
124
+ *
125
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
45
126
  */
46
- alias?: Record<string, string>;
127
+ alias?: Record<string, string> | Array<{
128
+ find: string | RegExp;
129
+ replacement: string;
130
+ }>;
47
131
  /**
48
132
  * A list of modules that should not be bundled, even if they are external dependencies.
49
133
  *
@@ -60,13 +144,14 @@ interface BuildConfig {
60
144
  */
61
145
  skipNodeModulesBundle?: boolean;
62
146
  /**
63
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
147
+ * An optional set of override options to apply to the selected build variant.
64
148
  *
65
- * @defaultValue false
149
+ * @remarks
150
+ * 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
151
  */
67
- skipPrepare?: boolean;
152
+ override?: Record<string, any>;
68
153
  }
69
- type BuildResolvedConfig = BuildConfig;
154
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
70
155
 
71
156
  type ReflectionMode = "default" | "explicit" | "never";
72
157
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -132,11 +217,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
132
217
  tsconfigFilePath: string;
133
218
  };
134
219
 
135
- declare const __VFS_INIT__ = "__VFS_INIT__";
136
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
137
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
138
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
139
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
220
+ declare const __VFS_PATCH__: unique symbol;
221
+ declare const __VFS_REVERT__: unique symbol;
140
222
  type OutputModeType = "fs" | "virtual";
141
223
  interface VirtualFile {
142
224
  /**
@@ -176,7 +258,24 @@ interface VirtualFile {
176
258
  */
177
259
  code: string | NodeJS.ArrayBufferView;
178
260
  }
179
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
261
+ interface VirtualFileMetadata {
262
+ /**
263
+ * The identifier for the file data.
264
+ */
265
+ id: string;
266
+ /**
267
+ * The variant of the file.
268
+ */
269
+ variant: string;
270
+ /**
271
+ * The output mode of the file.
272
+ */
273
+ mode: string;
274
+ /**
275
+ * Additional metadata associated with the file.
276
+ */
277
+ properties: Record<string, string>;
278
+ }
180
279
  interface ResolveFSOptions {
181
280
  mode?: OutputModeType;
182
281
  }
@@ -205,12 +304,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
205
304
  type?: "file" | "directory";
206
305
  }
207
306
  interface VirtualFileSystemInterface {
208
- [__VFS_INIT__]: () => void;
307
+ /**
308
+ * Patches the File System to include the virtual file system (VFS) contents.
309
+ */
310
+ [__VFS_PATCH__]: () => void;
311
+ /**
312
+ * Reverts the virtual file system (VFS) to its previous state.
313
+ */
209
314
  [__VFS_REVERT__]: () => void;
210
315
  /**
211
316
  * The underlying file metadata.
212
317
  */
213
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
318
+ metadata: Record<string, VirtualFileMetadata | undefined>;
214
319
  /**
215
320
  * A map of module ids to their file paths.
216
321
  */
@@ -230,7 +335,7 @@ interface VirtualFileSystemInterface {
230
335
  * @param options - Optional parameters for resolving the path.
231
336
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
232
337
  */
233
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
338
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
234
339
  /**
235
340
  * Checks if a file exists in the virtual file system (VFS).
236
341
  *
@@ -245,15 +350,6 @@ interface VirtualFileSystemInterface {
245
350
  * @returns `true` if the directory exists, otherwise `false`.
246
351
  */
247
352
  isDirectory: (path: string) => boolean;
248
- /**
249
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
250
- *
251
- * @see https://www.typescriptlang.org/tsconfig#paths
252
- *
253
- * @param pathOrId - The path or id to check.
254
- * @returns Whether the path or id corresponds to a virtual file.
255
- */
256
- isTsconfigPath: (pathOrId: string) => boolean;
257
353
  /**
258
354
  * Checks if a file exists in the virtual file system (VFS).
259
355
  *
@@ -267,7 +363,7 @@ interface VirtualFileSystemInterface {
267
363
  * @param pathOrId - The path or id of the file.
268
364
  * @returns The metadata of the file if it exists, otherwise undefined.
269
365
  */
270
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
366
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
271
367
  /**
272
368
  * Gets the stats of a file in the virtual file system (VFS).
273
369
  *
@@ -475,23 +571,12 @@ interface VirtualFileSystemInterface {
475
571
  */
476
572
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
477
573
  /**
478
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
479
- *
480
- * @see https://www.typescriptlang.org/tsconfig#paths
481
- *
482
- * @param path - The path to check.
483
- * @returns The resolved file path if it exists, otherwise undefined.
484
- */
485
- resolveTsconfigPath: (path: string) => string | false;
486
- /**
487
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
488
- *
489
- * @see https://www.typescriptlang.org/tsconfig#paths
574
+ * Formats a path to match the virtual file system (VFS) structure.
490
575
  *
491
- * @param path - The path to check.
492
- * @returns The resolved package name if it exists, otherwise undefined.
576
+ * @param path - The path to format.
577
+ * @returns The formatted path.
493
578
  */
494
- resolveTsconfigPathPackage: (path: string) => string | false;
579
+ formatPath: (path: string) => string;
495
580
  /**
496
581
  * Resolves a path or id to a file path in the virtual file system.
497
582
  *
@@ -500,23 +585,9 @@ interface VirtualFileSystemInterface {
500
585
  */
501
586
  realpathSync: (pathOrId: string) => string;
502
587
  /**
503
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
504
- *
505
- * @returns A record mapping file paths to their partial metadata.
506
- */
507
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
508
- /**
509
- * A map of cached file paths to their underlying file content.
510
- */
511
- [__VFS_CACHE__]: Map<string, string>;
512
- /**
513
- * A reference to the underlying virtual file system.
588
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
514
589
  */
515
- [__VFS_VIRTUAL__]: Volume;
516
- /**
517
- * A reference to the underlying unified file system.
518
- */
519
- [__VFS_UNIFIED__]: IUnionFs;
590
+ dispose: () => Promise<void>;
520
591
  }
521
592
 
522
593
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -642,24 +713,33 @@ interface BaseConfig {
642
713
  * The entry point(s) for the application
643
714
  */
644
715
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
716
+ /**
717
+ * Configuration for the output of the build process
718
+ */
719
+ output?: OutputConfig;
645
720
  /**
646
721
  * Configuration for linting the source code
722
+ *
723
+ * @remarks
724
+ * If set to `false`, linting will be disabled.
647
725
  */
648
726
  lint?: Record<string, any> | false;
649
727
  /**
650
728
  * Configuration for testing the source code
729
+ *
730
+ * @remarks
731
+ * If set to `false`, testing will be disabled.
651
732
  */
652
733
  test?: Record<string, any> | false;
653
- /**
654
- * Configuration for the output of the build process
655
- */
656
- output?: OutputConfig;
657
734
  /**
658
735
  * Configuration for the transformation of the source code
659
736
  */
660
737
  transform?: Record<string, any>;
661
738
  /**
662
- * Options to to provide to the build process
739
+ * Configuration provided to build processes
740
+ *
741
+ * @remarks
742
+ * 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
743
  */
664
744
  build?: BuildConfig;
665
745
  /**
@@ -669,6 +749,13 @@ interface BaseConfig {
669
749
  * This configuration will be used by the documentation generation plugins during the `docs` command.
670
750
  */
671
751
  docs?: Record<string, any>;
752
+ /**
753
+ * Configuration for deploying the source code
754
+ *
755
+ * @remarks
756
+ * If set to `false`, the deployment will be disabled.
757
+ */
758
+ deploy?: Record<string, any> | false;
672
759
  /**
673
760
  * The path to the tsconfig file to be used by the compiler
674
761
  *
@@ -689,37 +776,6 @@ interface BaseConfig {
689
776
  tsconfigRaw?: TSConfig;
690
777
  }
691
778
  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
779
  /**
724
780
  * Configuration options for the preview server
725
781
  */
@@ -792,16 +848,28 @@ interface CommonUserConfig extends BaseConfig {
792
848
  */
793
849
  framework?: string;
794
850
  }
795
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
796
- build?: TBuildConfig & {
851
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
852
+ /**
853
+ * Configuration provided to build processes
854
+ *
855
+ * @remarks
856
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
857
+ */
858
+ build: Omit<TBuildConfig, "override"> & {
797
859
  /**
798
860
  * The build variant being used by the Powerlines engine.
799
861
  */
800
862
  variant?: TBuildVariant;
863
+ /**
864
+ * An optional set of override options to apply to the selected build variant.
865
+ *
866
+ * @remarks
867
+ * 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.
868
+ */
869
+ override?: Partial<TBuildResolvedConfig>;
801
870
  };
802
- override?: Partial<TBuildResolvedConfig>;
803
871
  };
804
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
872
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
805
873
  /**
806
874
  * The configuration provided while executing Powerlines commands.
807
875
  */
@@ -822,7 +890,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
822
890
  */
823
891
  output?: string;
824
892
  }
825
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
893
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
826
894
  /**
827
895
  * The name of the environment
828
896
  */
@@ -839,7 +907,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
839
907
  /**
840
908
  * The resolved options for the Powerlines project configuration.
841
909
  */
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">> & {
910
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework">> & {
843
911
  /**
844
912
  * The configuration options that were provided inline to the Powerlines CLI.
845
913
  */
@@ -870,6 +938,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
870
938
  * The output configuration options to use for the build process
871
939
  */
872
940
  output: OutputResolvedConfig;
941
+ /**
942
+ * Configuration provided to build processes
943
+ *
944
+ * @remarks
945
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
946
+ */
947
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
873
948
  /**
874
949
  * The log level to use for the Powerlines processes.
875
950
  *
@@ -903,14 +978,6 @@ interface MetaInfo {
903
978
  * A hash that represents the path to the project root directory
904
979
  */
905
980
  configHash: string;
906
- /**
907
- * A mapping of runtime ids to their corresponding file paths
908
- */
909
- builtinIdMap: Record<string, string>;
910
- /**
911
- * A mapping of virtual file paths to their corresponding file contents
912
- */
913
- virtualFiles: Record<string, string | null>;
914
981
  }
915
982
  interface Resolver extends Jiti {
916
983
  plugin: Jiti;
@@ -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
@@ -1103,7 +1185,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1103
1185
  }
1104
1186
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1105
1187
 
1106
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1188
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1107
1189
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1108
1190
 
1109
1191
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -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 { B as BiomePluginOptions, P as Plugin, a as BiomePluginContext } from './index-BeLwWy2n.cjs';
2
- export { c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from './index-BeLwWy2n.cjs';
1
+ import { B as BiomePluginOptions, P as Plugin, a as BiomePluginContext } from './index-C6ogbqgm.cjs';
2
+ export { c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from './index-C6ogbqgm.cjs';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
5
5
  import '@storm-software/config/types';
@@ -16,9 +16,7 @@ import 'unplugin';
16
16
  import '@stryke/types/tsconfig';
17
17
  import 'typescript';
18
18
  import '@stryke/json/types';
19
- import 'memfs';
20
19
  import 'node:fs';
21
- import 'unionfs';
22
20
  import '@stryke/types/array';
23
21
 
24
22
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BiomePluginOptions, P as Plugin, a as BiomePluginContext } from './index-BeLwWy2n.js';
2
- export { c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from './index-BeLwWy2n.js';
1
+ import { B as BiomePluginOptions, P as Plugin, a as BiomePluginContext } from './index-C6ogbqgm.js';
2
+ export { c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from './index-C6ogbqgm.js';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
5
5
  import '@storm-software/config/types';
@@ -16,9 +16,7 @@ import 'unplugin';
16
16
  import '@stryke/types/tsconfig';
17
17
  import 'typescript';
18
18
  import '@stryke/json/types';
19
- import 'memfs';
20
19
  import 'node:fs';
21
- import 'unionfs';
22
20
  import '@stryke/types/array';
23
21
 
24
22
  /**
@@ -1,4 +1,4 @@
1
- export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-BeLwWy2n.cjs';
1
+ export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-C6ogbqgm.cjs';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -15,7 +15,5 @@ import 'unplugin';
15
15
  import '@stryke/types/tsconfig';
16
16
  import 'typescript';
17
17
  import '@stryke/json/types';
18
- import 'memfs';
19
18
  import 'node:fs';
20
- import 'unionfs';
21
19
  import '@stryke/types/array';
@@ -1,4 +1,4 @@
1
- export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-BeLwWy2n.js';
1
+ export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-C6ogbqgm.js';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -15,7 +15,5 @@ import 'unplugin';
15
15
  import '@stryke/types/tsconfig';
16
16
  import 'typescript';
17
17
  import '@stryke/json/types';
18
- import 'memfs';
19
18
  import 'node:fs';
20
- import 'unionfs';
21
19
  import '@stryke/types/array';
@@ -1,4 +1,4 @@
1
- export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-BeLwWy2n.cjs';
1
+ export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-C6ogbqgm.cjs';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -15,7 +15,5 @@ import 'unplugin';
15
15
  import '@stryke/types/tsconfig';
16
16
  import 'typescript';
17
17
  import '@stryke/json/types';
18
- import 'memfs';
19
18
  import 'node:fs';
20
- import 'unionfs';
21
19
  import '@stryke/types/array';
@@ -1,4 +1,4 @@
1
- export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-BeLwWy2n.js';
1
+ export { a as BiomePluginContext, B as BiomePluginOptions, c as BiomePluginResolvedConfig, b as BiomePluginUserConfig } from '../index-C6ogbqgm.js';
2
2
  import '@storm-software/build-tools/types';
3
3
  import '@storm-software/config-tools/types';
4
4
  import '@storm-software/config/types';
@@ -15,7 +15,5 @@ import 'unplugin';
15
15
  import '@stryke/types/tsconfig';
16
16
  import 'typescript';
17
17
  import '@stryke/json/types';
18
- import 'memfs';
19
18
  import 'node:fs';
20
- import 'unionfs';
21
19
  import '@stryke/types/array';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-biome",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for running Biome linting on the codebase.",
6
6
  "repository": {
@@ -96,14 +96,14 @@
96
96
  "@stryke/fs": "^0.32.13",
97
97
  "@stryke/path": "^0.19.2",
98
98
  "defu": "^6.1.4",
99
- "powerlines": "^0.19.5"
99
+ "powerlines": "^0.21.0"
100
100
  },
101
101
  "devDependencies": {
102
- "@biomejs/biome": "^2.3.5",
103
- "@powerlines/nx": "^0.10.9",
102
+ "@biomejs/biome": "^2.3.6",
103
+ "@powerlines/nx": "^0.10.11",
104
104
  "@storm-software/tsup": "^0.2.38",
105
105
  "@types/node": "^22.19.1"
106
106
  },
107
107
  "publishConfig": { "access": "public" },
108
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
108
+ "gitHead": "c6ed2ca745c8f340a55758b3102933dc41e83428"
109
109
  }