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