@powerlines/plugin-prisma 0.1.9 → 0.1.11

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