@powerlines/plugin-typedoc 0.10.17 → 0.10.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.
@@ -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
  import { TypeDocOptions, Application, ProjectReflection } from 'typedoc';
22
20
 
@@ -28,6 +26,87 @@ interface BuildConfig {
28
26
  * @defaultValue "neutral"
29
27
  */
30
28
  platform?: "node" | "browser" | "neutral";
29
+ /**
30
+ * Array of strings indicating the polyfills to include for the build.
31
+ *
32
+ * @remarks
33
+ * 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).
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * {
38
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
39
+ * }
40
+ * ```
41
+ */
42
+ polyfill?: string[];
43
+ /**
44
+ * 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.
45
+ *
46
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
47
+ */
48
+ mainFields?: string[];
49
+ /**
50
+ * Array of strings indicating what conditions should be used for module resolution.
51
+ */
52
+ conditions?: string[];
53
+ /**
54
+ * Array of strings indicating what file extensions should be used for module resolution.
55
+ *
56
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
57
+ */
58
+ extensions?: string[];
59
+ /**
60
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
61
+ *
62
+ * @remarks
63
+ * 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.
64
+ */
65
+ dedupe?: string[];
66
+ /**
67
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
68
+ */
69
+ builtins?: (string | RegExp)[];
70
+ /**
71
+ * Define global variable replacements.
72
+ *
73
+ * @remarks
74
+ * 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.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * {
79
+ * define: {
80
+ * __VERSION__: '"1.0.0"',
81
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
82
+ * }
83
+ * }
84
+ * ```
85
+ *
86
+ * @see https://esbuild.github.io/api/#define
87
+ * @see https://vitejs.dev/config/build-options.html#define
88
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
89
+ */
90
+ define?: Record<string, any>;
91
+ /**
92
+ * Global variables that will have import statements injected where necessary
93
+ *
94
+ * @remarks
95
+ * 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.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * {
100
+ * inject: {
101
+ * process: 'process/browser',
102
+ * Buffer: ['buffer', 'Buffer'],
103
+ * }
104
+ * }
105
+ * ```
106
+ *
107
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
108
+ */
109
+ inject?: Record<string, string | string[]>;
31
110
  /**
32
111
  * The alias mappings to use for module resolution during the build process.
33
112
  *
@@ -43,8 +122,13 @@ interface BuildConfig {
43
122
  * }
44
123
  * }
45
124
  * ```
125
+ *
126
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
46
127
  */
47
- alias?: Record<string, string>;
128
+ alias?: Record<string, string> | Array<{
129
+ find: string | RegExp;
130
+ replacement: string;
131
+ }>;
48
132
  /**
49
133
  * A list of modules that should not be bundled, even if they are external dependencies.
50
134
  *
@@ -61,13 +145,14 @@ interface BuildConfig {
61
145
  */
62
146
  skipNodeModulesBundle?: boolean;
63
147
  /**
64
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
148
+ * An optional set of override options to apply to the selected build variant.
65
149
  *
66
- * @defaultValue false
150
+ * @remarks
151
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
67
152
  */
68
- skipPrepare?: boolean;
153
+ override?: Record<string, any>;
69
154
  }
70
- type BuildResolvedConfig = BuildConfig;
155
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
71
156
 
72
157
  type ReflectionMode = "default" | "explicit" | "never";
73
158
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -133,11 +218,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
133
218
  tsconfigFilePath: string;
134
219
  };
135
220
 
136
- declare const __VFS_INIT__ = "__VFS_INIT__";
137
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
138
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
139
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
140
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
221
+ declare const __VFS_PATCH__: unique symbol;
222
+ declare const __VFS_REVERT__: unique symbol;
141
223
  type OutputModeType = "fs" | "virtual";
142
224
  interface VirtualFile {
143
225
  /**
@@ -177,7 +259,24 @@ interface VirtualFile {
177
259
  */
178
260
  code: string | NodeJS.ArrayBufferView;
179
261
  }
180
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
262
+ interface VirtualFileMetadata {
263
+ /**
264
+ * The identifier for the file data.
265
+ */
266
+ id: string;
267
+ /**
268
+ * The variant of the file.
269
+ */
270
+ variant: string;
271
+ /**
272
+ * The output mode of the file.
273
+ */
274
+ mode: string;
275
+ /**
276
+ * Additional metadata associated with the file.
277
+ */
278
+ properties: Record<string, string>;
279
+ }
181
280
  interface ResolveFSOptions {
182
281
  mode?: OutputModeType;
183
282
  }
@@ -206,12 +305,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
206
305
  type?: "file" | "directory";
207
306
  }
208
307
  interface VirtualFileSystemInterface {
209
- [__VFS_INIT__]: () => void;
308
+ /**
309
+ * Patches the File System to include the virtual file system (VFS) contents.
310
+ */
311
+ [__VFS_PATCH__]: () => void;
312
+ /**
313
+ * Reverts the virtual file system (VFS) to its previous state.
314
+ */
210
315
  [__VFS_REVERT__]: () => void;
211
316
  /**
212
317
  * The underlying file metadata.
213
318
  */
214
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
319
+ metadata: Record<string, VirtualFileMetadata | undefined>;
215
320
  /**
216
321
  * A map of module ids to their file paths.
217
322
  */
@@ -231,7 +336,7 @@ interface VirtualFileSystemInterface {
231
336
  * @param options - Optional parameters for resolving the path.
232
337
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
233
338
  */
234
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
339
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
235
340
  /**
236
341
  * Checks if a file exists in the virtual file system (VFS).
237
342
  *
@@ -246,15 +351,6 @@ interface VirtualFileSystemInterface {
246
351
  * @returns `true` if the directory exists, otherwise `false`.
247
352
  */
248
353
  isDirectory: (path: string) => boolean;
249
- /**
250
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
251
- *
252
- * @see https://www.typescriptlang.org/tsconfig#paths
253
- *
254
- * @param pathOrId - The path or id to check.
255
- * @returns Whether the path or id corresponds to a virtual file.
256
- */
257
- isTsconfigPath: (pathOrId: string) => boolean;
258
354
  /**
259
355
  * Checks if a file exists in the virtual file system (VFS).
260
356
  *
@@ -268,7 +364,7 @@ interface VirtualFileSystemInterface {
268
364
  * @param pathOrId - The path or id of the file.
269
365
  * @returns The metadata of the file if it exists, otherwise undefined.
270
366
  */
271
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
367
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
272
368
  /**
273
369
  * Gets the stats of a file in the virtual file system (VFS).
274
370
  *
@@ -476,23 +572,12 @@ interface VirtualFileSystemInterface {
476
572
  */
477
573
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
478
574
  /**
479
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
480
- *
481
- * @see https://www.typescriptlang.org/tsconfig#paths
482
- *
483
- * @param path - The path to check.
484
- * @returns The resolved file path if it exists, otherwise undefined.
485
- */
486
- resolveTsconfigPath: (path: string) => string | false;
487
- /**
488
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
489
- *
490
- * @see https://www.typescriptlang.org/tsconfig#paths
575
+ * Formats a path to match the virtual file system (VFS) structure.
491
576
  *
492
- * @param path - The path to check.
493
- * @returns The resolved package name if it exists, otherwise undefined.
577
+ * @param path - The path to format.
578
+ * @returns The formatted path.
494
579
  */
495
- resolveTsconfigPathPackage: (path: string) => string | false;
580
+ formatPath: (path: string) => string;
496
581
  /**
497
582
  * Resolves a path or id to a file path in the virtual file system.
498
583
  *
@@ -501,23 +586,9 @@ interface VirtualFileSystemInterface {
501
586
  */
502
587
  realpathSync: (pathOrId: string) => string;
503
588
  /**
504
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
505
- *
506
- * @returns A record mapping file paths to their partial metadata.
507
- */
508
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
509
- /**
510
- * A map of cached file paths to their underlying file content.
511
- */
512
- [__VFS_CACHE__]: Map<string, string>;
513
- /**
514
- * A reference to the underlying virtual file system.
589
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
515
590
  */
516
- [__VFS_VIRTUAL__]: Volume;
517
- /**
518
- * A reference to the underlying unified file system.
519
- */
520
- [__VFS_UNIFIED__]: IUnionFs;
591
+ dispose: () => Promise<void>;
521
592
  }
522
593
 
523
594
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -643,24 +714,33 @@ interface BaseConfig {
643
714
  * The entry point(s) for the application
644
715
  */
645
716
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
717
+ /**
718
+ * Configuration for the output of the build process
719
+ */
720
+ output?: OutputConfig;
646
721
  /**
647
722
  * Configuration for linting the source code
723
+ *
724
+ * @remarks
725
+ * If set to `false`, linting will be disabled.
648
726
  */
649
727
  lint?: Record<string, any> | false;
650
728
  /**
651
729
  * Configuration for testing the source code
730
+ *
731
+ * @remarks
732
+ * If set to `false`, testing will be disabled.
652
733
  */
653
734
  test?: Record<string, any> | false;
654
- /**
655
- * Configuration for the output of the build process
656
- */
657
- output?: OutputConfig;
658
735
  /**
659
736
  * Configuration for the transformation of the source code
660
737
  */
661
738
  transform?: Record<string, any>;
662
739
  /**
663
- * Options to to provide to the build process
740
+ * Configuration provided to build processes
741
+ *
742
+ * @remarks
743
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
664
744
  */
665
745
  build?: BuildConfig;
666
746
  /**
@@ -670,6 +750,13 @@ interface BaseConfig {
670
750
  * This configuration will be used by the documentation generation plugins during the `docs` command.
671
751
  */
672
752
  docs?: Record<string, any>;
753
+ /**
754
+ * Configuration for deploying the source code
755
+ *
756
+ * @remarks
757
+ * If set to `false`, the deployment will be disabled.
758
+ */
759
+ deploy?: Record<string, any> | false;
673
760
  /**
674
761
  * The path to the tsconfig file to be used by the compiler
675
762
  *
@@ -690,37 +777,6 @@ interface BaseConfig {
690
777
  tsconfigRaw?: TSConfig;
691
778
  }
692
779
  interface EnvironmentConfig extends BaseConfig {
693
- /**
694
- * 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.
695
- *
696
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
697
- */
698
- mainFields?: string[];
699
- /**
700
- * Array of strings indicating what conditions should be used for module resolution.
701
- */
702
- conditions?: string[];
703
- /**
704
- * Array of strings indicating what conditions should be used for external modules.
705
- */
706
- externalConditions?: string[];
707
- /**
708
- * Array of strings indicating what file extensions should be used for module resolution.
709
- *
710
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
711
- */
712
- extensions?: string[];
713
- /**
714
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
715
- *
716
- * @remarks
717
- * 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.
718
- */
719
- dedupe?: string[];
720
- /**
721
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
722
- */
723
- builtins?: (string | RegExp)[];
724
780
  /**
725
781
  * Configuration options for the preview server
726
782
  */
@@ -793,16 +849,28 @@ interface CommonUserConfig extends BaseConfig {
793
849
  */
794
850
  framework?: string;
795
851
  }
796
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
797
- build?: TBuildConfig & {
852
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
853
+ /**
854
+ * Configuration provided to build processes
855
+ *
856
+ * @remarks
857
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
858
+ */
859
+ build: Omit<TBuildConfig, "override"> & {
798
860
  /**
799
861
  * The build variant being used by the Powerlines engine.
800
862
  */
801
863
  variant?: TBuildVariant;
864
+ /**
865
+ * An optional set of override options to apply to the selected build variant.
866
+ *
867
+ * @remarks
868
+ * 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.
869
+ */
870
+ override?: Partial<TBuildResolvedConfig>;
802
871
  };
803
- override?: Partial<TBuildResolvedConfig>;
804
872
  };
805
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
873
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
806
874
  /**
807
875
  * The configuration provided while executing Powerlines commands.
808
876
  */
@@ -823,7 +891,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
823
891
  */
824
892
  output?: string;
825
893
  }
826
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
894
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
827
895
  /**
828
896
  * The name of the environment
829
897
  */
@@ -840,7 +908,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
840
908
  /**
841
909
  * The resolved options for the Powerlines project configuration.
842
910
  */
843
- 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">> & {
911
+ 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">> & {
844
912
  /**
845
913
  * The configuration options that were provided inline to the Powerlines CLI.
846
914
  */
@@ -871,6 +939,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
871
939
  * The output configuration options to use for the build process
872
940
  */
873
941
  output: OutputResolvedConfig;
942
+ /**
943
+ * Configuration provided to build processes
944
+ *
945
+ * @remarks
946
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
947
+ */
948
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
874
949
  /**
875
950
  * The log level to use for the Powerlines processes.
876
951
  *
@@ -904,14 +979,6 @@ interface MetaInfo {
904
979
  * A hash that represents the path to the project root directory
905
980
  */
906
981
  configHash: string;
907
- /**
908
- * A mapping of runtime ids to their corresponding file paths
909
- */
910
- builtinIdMap: Record<string, string>;
911
- /**
912
- * A mapping of virtual file paths to their corresponding file contents
913
- */
914
- virtualFiles: Record<string, string | null>;
915
982
  }
916
983
  interface Resolver extends Jiti {
917
984
  plugin: Jiti;
@@ -924,7 +991,13 @@ interface InitContextOptions {
924
991
  */
925
992
  isHighPriority: boolean;
926
993
  }
927
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
994
+ /**
995
+ * The unresolved Powerlines context.
996
+ *
997
+ * @remarks
998
+ * This context is used before the user configuration has been fully resolved after the `config`.
999
+ */
1000
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
928
1001
  /**
929
1002
  * The Storm workspace configuration
930
1003
  */
@@ -932,7 +1005,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
932
1005
  /**
933
1006
  * An object containing the options provided to Powerlines
934
1007
  */
935
- config: TResolvedConfig;
1008
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1009
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1010
+ output: TResolvedConfig["output"];
1011
+ };
936
1012
  /**
937
1013
  * A logging function for the Powerlines engine
938
1014
  */
@@ -1089,6 +1165,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1089
1165
  */
1090
1166
  extendLog: (name: string) => LogFn;
1091
1167
  }
1168
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1169
+ /**
1170
+ * The fully resolved Powerlines configuration
1171
+ */
1172
+ config: TResolvedConfig;
1173
+ };
1092
1174
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1093
1175
  /**
1094
1176
  * The environment specific resolved configuration
@@ -1104,7 +1186,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1104
1186
  }
1105
1187
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1106
1188
 
1107
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1189
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1108
1190
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1109
1191
 
1110
1192
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -1129,6 +1211,10 @@ interface GenerateTypesResult {
1129
1211
  directives?: string[];
1130
1212
  code: string;
1131
1213
  }
1214
+ type DeepPartial<T> = {
1215
+ [K in keyof T]?: DeepPartial<T[K]>;
1216
+ };
1217
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1132
1218
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1133
1219
  /**
1134
1220
  * A function that returns configuration options to be merged with the build context's options.
@@ -1144,7 +1230,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1144
1230
  * @param config - The partial configuration object to be modified.
1145
1231
  * @returns A promise that resolves to a partial configuration object.
1146
1232
  */
1147
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1233
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1148
1234
  /**
1149
1235
  * 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.
1150
1236
  *
@@ -1247,7 +1333,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1247
1333
  * @param config - The partial configuration object to be modified.
1248
1334
  * @returns A promise that resolves to a partial configuration object.
1249
1335
  */
1250
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1336
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1251
1337
  /**
1252
1338
  * A hook that is called to transform the source code.
1253
1339
  *
@@ -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
  import { TypeDocOptions, Application, ProjectReflection } from 'typedoc';
22
20
 
@@ -28,6 +26,87 @@ interface BuildConfig {
28
26
  * @defaultValue "neutral"
29
27
  */
30
28
  platform?: "node" | "browser" | "neutral";
29
+ /**
30
+ * Array of strings indicating the polyfills to include for the build.
31
+ *
32
+ * @remarks
33
+ * 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).
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * {
38
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
39
+ * }
40
+ * ```
41
+ */
42
+ polyfill?: string[];
43
+ /**
44
+ * 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.
45
+ *
46
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
47
+ */
48
+ mainFields?: string[];
49
+ /**
50
+ * Array of strings indicating what conditions should be used for module resolution.
51
+ */
52
+ conditions?: string[];
53
+ /**
54
+ * Array of strings indicating what file extensions should be used for module resolution.
55
+ *
56
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
57
+ */
58
+ extensions?: string[];
59
+ /**
60
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
61
+ *
62
+ * @remarks
63
+ * 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.
64
+ */
65
+ dedupe?: string[];
66
+ /**
67
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
68
+ */
69
+ builtins?: (string | RegExp)[];
70
+ /**
71
+ * Define global variable replacements.
72
+ *
73
+ * @remarks
74
+ * 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.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * {
79
+ * define: {
80
+ * __VERSION__: '"1.0.0"',
81
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
82
+ * }
83
+ * }
84
+ * ```
85
+ *
86
+ * @see https://esbuild.github.io/api/#define
87
+ * @see https://vitejs.dev/config/build-options.html#define
88
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
89
+ */
90
+ define?: Record<string, any>;
91
+ /**
92
+ * Global variables that will have import statements injected where necessary
93
+ *
94
+ * @remarks
95
+ * 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.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * {
100
+ * inject: {
101
+ * process: 'process/browser',
102
+ * Buffer: ['buffer', 'Buffer'],
103
+ * }
104
+ * }
105
+ * ```
106
+ *
107
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
108
+ */
109
+ inject?: Record<string, string | string[]>;
31
110
  /**
32
111
  * The alias mappings to use for module resolution during the build process.
33
112
  *
@@ -43,8 +122,13 @@ interface BuildConfig {
43
122
  * }
44
123
  * }
45
124
  * ```
125
+ *
126
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
46
127
  */
47
- alias?: Record<string, string>;
128
+ alias?: Record<string, string> | Array<{
129
+ find: string | RegExp;
130
+ replacement: string;
131
+ }>;
48
132
  /**
49
133
  * A list of modules that should not be bundled, even if they are external dependencies.
50
134
  *
@@ -61,13 +145,14 @@ interface BuildConfig {
61
145
  */
62
146
  skipNodeModulesBundle?: boolean;
63
147
  /**
64
- * Should the Powerlines processes skip the `"prepare"` task prior to building?
148
+ * An optional set of override options to apply to the selected build variant.
65
149
  *
66
- * @defaultValue false
150
+ * @remarks
151
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
67
152
  */
68
- skipPrepare?: boolean;
153
+ override?: Record<string, any>;
69
154
  }
70
- type BuildResolvedConfig = BuildConfig;
155
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
71
156
 
72
157
  type ReflectionMode = "default" | "explicit" | "never";
73
158
  type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
@@ -133,11 +218,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
133
218
  tsconfigFilePath: string;
134
219
  };
135
220
 
136
- declare const __VFS_INIT__ = "__VFS_INIT__";
137
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
138
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
139
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
140
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
221
+ declare const __VFS_PATCH__: unique symbol;
222
+ declare const __VFS_REVERT__: unique symbol;
141
223
  type OutputModeType = "fs" | "virtual";
142
224
  interface VirtualFile {
143
225
  /**
@@ -177,7 +259,24 @@ interface VirtualFile {
177
259
  */
178
260
  code: string | NodeJS.ArrayBufferView;
179
261
  }
180
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
262
+ interface VirtualFileMetadata {
263
+ /**
264
+ * The identifier for the file data.
265
+ */
266
+ id: string;
267
+ /**
268
+ * The variant of the file.
269
+ */
270
+ variant: string;
271
+ /**
272
+ * The output mode of the file.
273
+ */
274
+ mode: string;
275
+ /**
276
+ * Additional metadata associated with the file.
277
+ */
278
+ properties: Record<string, string>;
279
+ }
181
280
  interface ResolveFSOptions {
182
281
  mode?: OutputModeType;
183
282
  }
@@ -206,12 +305,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
206
305
  type?: "file" | "directory";
207
306
  }
208
307
  interface VirtualFileSystemInterface {
209
- [__VFS_INIT__]: () => void;
308
+ /**
309
+ * Patches the File System to include the virtual file system (VFS) contents.
310
+ */
311
+ [__VFS_PATCH__]: () => void;
312
+ /**
313
+ * Reverts the virtual file system (VFS) to its previous state.
314
+ */
210
315
  [__VFS_REVERT__]: () => void;
211
316
  /**
212
317
  * The underlying file metadata.
213
318
  */
214
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
319
+ metadata: Record<string, VirtualFileMetadata | undefined>;
215
320
  /**
216
321
  * A map of module ids to their file paths.
217
322
  */
@@ -231,7 +336,7 @@ interface VirtualFileSystemInterface {
231
336
  * @param options - Optional parameters for resolving the path.
232
337
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
233
338
  */
234
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
339
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
235
340
  /**
236
341
  * Checks if a file exists in the virtual file system (VFS).
237
342
  *
@@ -246,15 +351,6 @@ interface VirtualFileSystemInterface {
246
351
  * @returns `true` if the directory exists, otherwise `false`.
247
352
  */
248
353
  isDirectory: (path: string) => boolean;
249
- /**
250
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
251
- *
252
- * @see https://www.typescriptlang.org/tsconfig#paths
253
- *
254
- * @param pathOrId - The path or id to check.
255
- * @returns Whether the path or id corresponds to a virtual file.
256
- */
257
- isTsconfigPath: (pathOrId: string) => boolean;
258
354
  /**
259
355
  * Checks if a file exists in the virtual file system (VFS).
260
356
  *
@@ -268,7 +364,7 @@ interface VirtualFileSystemInterface {
268
364
  * @param pathOrId - The path or id of the file.
269
365
  * @returns The metadata of the file if it exists, otherwise undefined.
270
366
  */
271
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
367
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
272
368
  /**
273
369
  * Gets the stats of a file in the virtual file system (VFS).
274
370
  *
@@ -476,23 +572,12 @@ interface VirtualFileSystemInterface {
476
572
  */
477
573
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
478
574
  /**
479
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
480
- *
481
- * @see https://www.typescriptlang.org/tsconfig#paths
482
- *
483
- * @param path - The path to check.
484
- * @returns The resolved file path if it exists, otherwise undefined.
485
- */
486
- resolveTsconfigPath: (path: string) => string | false;
487
- /**
488
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
489
- *
490
- * @see https://www.typescriptlang.org/tsconfig#paths
575
+ * Formats a path to match the virtual file system (VFS) structure.
491
576
  *
492
- * @param path - The path to check.
493
- * @returns The resolved package name if it exists, otherwise undefined.
577
+ * @param path - The path to format.
578
+ * @returns The formatted path.
494
579
  */
495
- resolveTsconfigPathPackage: (path: string) => string | false;
580
+ formatPath: (path: string) => string;
496
581
  /**
497
582
  * Resolves a path or id to a file path in the virtual file system.
498
583
  *
@@ -501,23 +586,9 @@ interface VirtualFileSystemInterface {
501
586
  */
502
587
  realpathSync: (pathOrId: string) => string;
503
588
  /**
504
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
505
- *
506
- * @returns A record mapping file paths to their partial metadata.
507
- */
508
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
509
- /**
510
- * A map of cached file paths to their underlying file content.
511
- */
512
- [__VFS_CACHE__]: Map<string, string>;
513
- /**
514
- * A reference to the underlying virtual file system.
589
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
515
590
  */
516
- [__VFS_VIRTUAL__]: Volume;
517
- /**
518
- * A reference to the underlying unified file system.
519
- */
520
- [__VFS_UNIFIED__]: IUnionFs;
591
+ dispose: () => Promise<void>;
521
592
  }
522
593
 
523
594
  type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
@@ -643,24 +714,33 @@ interface BaseConfig {
643
714
  * The entry point(s) for the application
644
715
  */
645
716
  entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
717
+ /**
718
+ * Configuration for the output of the build process
719
+ */
720
+ output?: OutputConfig;
646
721
  /**
647
722
  * Configuration for linting the source code
723
+ *
724
+ * @remarks
725
+ * If set to `false`, linting will be disabled.
648
726
  */
649
727
  lint?: Record<string, any> | false;
650
728
  /**
651
729
  * Configuration for testing the source code
730
+ *
731
+ * @remarks
732
+ * If set to `false`, testing will be disabled.
652
733
  */
653
734
  test?: Record<string, any> | false;
654
- /**
655
- * Configuration for the output of the build process
656
- */
657
- output?: OutputConfig;
658
735
  /**
659
736
  * Configuration for the transformation of the source code
660
737
  */
661
738
  transform?: Record<string, any>;
662
739
  /**
663
- * Options to to provide to the build process
740
+ * Configuration provided to build processes
741
+ *
742
+ * @remarks
743
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
664
744
  */
665
745
  build?: BuildConfig;
666
746
  /**
@@ -670,6 +750,13 @@ interface BaseConfig {
670
750
  * This configuration will be used by the documentation generation plugins during the `docs` command.
671
751
  */
672
752
  docs?: Record<string, any>;
753
+ /**
754
+ * Configuration for deploying the source code
755
+ *
756
+ * @remarks
757
+ * If set to `false`, the deployment will be disabled.
758
+ */
759
+ deploy?: Record<string, any> | false;
673
760
  /**
674
761
  * The path to the tsconfig file to be used by the compiler
675
762
  *
@@ -690,37 +777,6 @@ interface BaseConfig {
690
777
  tsconfigRaw?: TSConfig;
691
778
  }
692
779
  interface EnvironmentConfig extends BaseConfig {
693
- /**
694
- * 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.
695
- *
696
- * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
697
- */
698
- mainFields?: string[];
699
- /**
700
- * Array of strings indicating what conditions should be used for module resolution.
701
- */
702
- conditions?: string[];
703
- /**
704
- * Array of strings indicating what conditions should be used for external modules.
705
- */
706
- externalConditions?: string[];
707
- /**
708
- * Array of strings indicating what file extensions should be used for module resolution.
709
- *
710
- * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
711
- */
712
- extensions?: string[];
713
- /**
714
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
715
- *
716
- * @remarks
717
- * 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.
718
- */
719
- dedupe?: string[];
720
- /**
721
- * Array of strings or regular expressions that indicate what modules are builtin for the environment.
722
- */
723
- builtins?: (string | RegExp)[];
724
780
  /**
725
781
  * Configuration options for the preview server
726
782
  */
@@ -793,16 +849,28 @@ interface CommonUserConfig extends BaseConfig {
793
849
  */
794
850
  framework?: string;
795
851
  }
796
- type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = CommonUserConfig & {
797
- build?: TBuildConfig & {
852
+ type UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> = Omit<CommonUserConfig, "build"> & {
853
+ /**
854
+ * Configuration provided to build processes
855
+ *
856
+ * @remarks
857
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
858
+ */
859
+ build: Omit<TBuildConfig, "override"> & {
798
860
  /**
799
861
  * The build variant being used by the Powerlines engine.
800
862
  */
801
863
  variant?: TBuildVariant;
864
+ /**
865
+ * An optional set of override options to apply to the selected build variant.
866
+ *
867
+ * @remarks
868
+ * 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.
869
+ */
870
+ override?: Partial<TBuildResolvedConfig>;
802
871
  };
803
- override?: Partial<TBuildResolvedConfig>;
804
872
  };
805
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "release" | "clean";
873
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
806
874
  /**
807
875
  * The configuration provided while executing Powerlines commands.
808
876
  */
@@ -823,7 +891,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
823
891
  */
824
892
  output?: string;
825
893
  }
826
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview" | "mainFields" | "extensions"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr" | "mainFields" | "extensions">> & {
894
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "mode" | "ssr">> & {
827
895
  /**
828
896
  * The name of the environment
829
897
  */
@@ -840,7 +908,7 @@ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
840
908
  /**
841
909
  * The resolved options for the Powerlines project configuration.
842
910
  */
843
- 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">> & {
911
+ 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">> & {
844
912
  /**
845
913
  * The configuration options that were provided inline to the Powerlines CLI.
846
914
  */
@@ -871,6 +939,13 @@ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserCon
871
939
  * The output configuration options to use for the build process
872
940
  */
873
941
  output: OutputResolvedConfig;
942
+ /**
943
+ * Configuration provided to build processes
944
+ *
945
+ * @remarks
946
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
947
+ */
948
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
874
949
  /**
875
950
  * The log level to use for the Powerlines processes.
876
951
  *
@@ -904,14 +979,6 @@ interface MetaInfo {
904
979
  * A hash that represents the path to the project root directory
905
980
  */
906
981
  configHash: string;
907
- /**
908
- * A mapping of runtime ids to their corresponding file paths
909
- */
910
- builtinIdMap: Record<string, string>;
911
- /**
912
- * A mapping of virtual file paths to their corresponding file contents
913
- */
914
- virtualFiles: Record<string, string | null>;
915
982
  }
916
983
  interface Resolver extends Jiti {
917
984
  plugin: Jiti;
@@ -924,7 +991,13 @@ interface InitContextOptions {
924
991
  */
925
992
  isHighPriority: boolean;
926
993
  }
927
- interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
994
+ /**
995
+ * The unresolved Powerlines context.
996
+ *
997
+ * @remarks
998
+ * This context is used before the user configuration has been fully resolved after the `config`.
999
+ */
1000
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
928
1001
  /**
929
1002
  * The Storm workspace configuration
930
1003
  */
@@ -932,7 +1005,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
932
1005
  /**
933
1006
  * An object containing the options provided to Powerlines
934
1007
  */
935
- config: TResolvedConfig;
1008
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1009
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1010
+ output: TResolvedConfig["output"];
1011
+ };
936
1012
  /**
937
1013
  * A logging function for the Powerlines engine
938
1014
  */
@@ -1089,6 +1165,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1089
1165
  */
1090
1166
  extendLog: (name: string) => LogFn;
1091
1167
  }
1168
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1169
+ /**
1170
+ * The fully resolved Powerlines configuration
1171
+ */
1172
+ config: TResolvedConfig;
1173
+ };
1092
1174
  interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1093
1175
  /**
1094
1176
  * The environment specific resolved configuration
@@ -1104,7 +1186,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
1104
1186
  }
1105
1187
  type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
1106
1188
 
1107
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "release", "finalize"];
1189
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1108
1190
  type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1109
1191
 
1110
1192
  interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
@@ -1129,6 +1211,10 @@ interface GenerateTypesResult {
1129
1211
  directives?: string[];
1130
1212
  code: string;
1131
1213
  }
1214
+ type DeepPartial<T> = {
1215
+ [K in keyof T]?: DeepPartial<T[K]>;
1216
+ };
1217
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
1132
1218
  interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
1133
1219
  /**
1134
1220
  * A function that returns configuration options to be merged with the build context's options.
@@ -1144,7 +1230,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1144
1230
  * @param config - The partial configuration object to be modified.
1145
1231
  * @returns A promise that resolves to a partial configuration object.
1146
1232
  */
1147
- config: (this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>;
1233
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
1148
1234
  /**
1149
1235
  * 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.
1150
1236
  *
@@ -1247,7 +1333,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1247
1333
  * @param config - The partial configuration object to be modified.
1248
1334
  * @returns A promise that resolves to a partial configuration object.
1249
1335
  */
1250
- config: PluginHook<(this: Context<TContext["config"]>) => MaybePromise<Partial<TContext["config"]["userConfig"]>>> | Partial<TContext["config"]["userConfig"]>;
1336
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
1251
1337
  /**
1252
1338
  * A hook that is called to transform the source code.
1253
1339
  *
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TypeDocPluginOptions, P as Plugin, a as TypeDocPluginContext } from './index-DBJ4x2zK.cjs';
2
- export { G as GenerateDocsOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from './index-DBJ4x2zK.cjs';
1
+ import { T as TypeDocPluginOptions, P as Plugin, a as TypeDocPluginContext } from './index-BqEoJsNI.cjs';
2
+ export { G as GenerateDocsOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from './index-BqEoJsNI.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
  import 'typedoc';
24
22
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { T as TypeDocPluginOptions, P as Plugin, a as TypeDocPluginContext } from './index-DBJ4x2zK.js';
2
- export { G as GenerateDocsOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from './index-DBJ4x2zK.js';
1
+ import { T as TypeDocPluginOptions, P as Plugin, a as TypeDocPluginContext } from './index-BqEoJsNI.js';
2
+ export { G as GenerateDocsOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from './index-BqEoJsNI.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
  import 'typedoc';
24
22
 
@@ -1,4 +1,4 @@
1
- export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-DBJ4x2zK.cjs';
1
+ export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-BqEoJsNI.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,8 +15,6 @@ 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';
22
20
  import 'typedoc';
@@ -1,4 +1,4 @@
1
- export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-DBJ4x2zK.js';
1
+ export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-BqEoJsNI.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,8 +15,6 @@ 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';
22
20
  import 'typedoc';
@@ -1,4 +1,4 @@
1
- export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-DBJ4x2zK.cjs';
1
+ export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-BqEoJsNI.cjs';
2
2
  import 'typedoc';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
@@ -16,7 +16,5 @@ 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';
@@ -1,4 +1,4 @@
1
- export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-DBJ4x2zK.js';
1
+ export { G as GenerateDocsOptions, a as TypeDocPluginContext, T as TypeDocPluginOptions, c as TypeDocPluginResolvedConfig, b as TypeDocPluginUserConfig } from '../index-BqEoJsNI.js';
2
2
  import 'typedoc';
3
3
  import '@storm-software/build-tools/types';
4
4
  import '@storm-software/config-tools/types';
@@ -16,7 +16,5 @@ 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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-typedoc",
3
- "version": "0.10.17",
3
+ "version": "0.10.19",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for running TypeDoc on the codebase.",
6
6
  "repository": {
@@ -91,16 +91,16 @@
91
91
  "@storm-software/config-tools": "^1.188.40",
92
92
  "@stryke/fs": "^0.32.13",
93
93
  "@stryke/path": "^0.19.2",
94
- "powerlines": "^0.19.5",
94
+ "powerlines": "^0.21.0",
95
95
  "typedoc": "0.25.12",
96
96
  "typedoc-plugin-markdown": "4.0.0-next.20"
97
97
  },
98
98
  "devDependencies": {
99
- "@powerlines/nx": "^0.10.9",
99
+ "@powerlines/nx": "^0.10.11",
100
100
  "@storm-software/tsup": "^0.2.38",
101
101
  "@types/node": "^22.19.1",
102
102
  "tsup": "8.4.0"
103
103
  },
104
104
  "publishConfig": { "access": "public" },
105
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
105
+ "gitHead": "c6ed2ca745c8f340a55758b3102933dc41e83428"
106
106
  }