@powerlines/plugin-vite 0.14.9 → 0.14.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.
- package/dist/helpers/index.d.cts +2 -4
- package/dist/helpers/index.d.ts +2 -4
- package/dist/helpers/unplugin.d.cts +2 -4
- package/dist/helpers/unplugin.d.ts +2 -4
- package/dist/{index-C9Wkx7zv.d.cts → index-BMkoiiHF.d.cts} +199 -113
- package/dist/{index-C9Wkx7zv.d.ts → index-BMkoiiHF.d.ts} +199 -113
- package/dist/index.d.cts +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/types/index.d.cts +2 -4
- package/dist/types/index.d.ts +2 -4
- package/dist/types/plugin.d.cts +2 -4
- package/dist/types/plugin.d.ts +2 -4
- package/package.json +5 -5
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserConfig as UserConfig$1, PreviewOptions, ResolvedPreviewOptions } from 'vite';
|
|
2
2
|
import { EnvPaths } from '@stryke/env/get-env-paths';
|
|
3
|
+
import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
|
|
3
4
|
import { PackageJson } from '@stryke/types/package-json';
|
|
4
5
|
import { Jiti } from 'jiti';
|
|
5
6
|
import { ParserOptions, ParseResult } from 'oxc-parser';
|
|
@@ -8,16 +9,13 @@ import { UnpluginMessage, UnpluginContext, UnpluginBuildContext, TransformResult
|
|
|
8
9
|
import { Format } from '@storm-software/build-tools/types';
|
|
9
10
|
import { LogLevelLabel } from '@storm-software/config-tools/types';
|
|
10
11
|
import { StormWorkspaceConfig } from '@storm-software/config/types';
|
|
11
|
-
import { MaybePromise, NonUndefined, FunctionLike } from '@stryke/types/base';
|
|
12
12
|
import { TypeDefinitionParameter, TypeDefinition } from '@stryke/types/configuration';
|
|
13
13
|
import { AssetGlob } from '@stryke/types/file';
|
|
14
14
|
import { ArrayValues } from '@stryke/types/array';
|
|
15
15
|
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
|
|
16
16
|
import ts from 'typescript';
|
|
17
17
|
import { PrimitiveJsonValue } from '@stryke/json/types';
|
|
18
|
-
import { Volume } from 'memfs';
|
|
19
18
|
import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
20
|
-
import { IUnionFs } from 'unionfs';
|
|
21
19
|
|
|
22
20
|
type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
|
|
23
21
|
interface BuildConfig {
|
|
@@ -27,6 +25,87 @@ interface BuildConfig {
|
|
|
27
25
|
* @defaultValue "neutral"
|
|
28
26
|
*/
|
|
29
27
|
platform?: "node" | "browser" | "neutral";
|
|
28
|
+
/**
|
|
29
|
+
* Array of strings indicating the polyfills to include for the build.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* {
|
|
37
|
+
* polyfill: ['{projectRoot}/custom-polyfill.ts']
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
polyfill?: string[];
|
|
42
|
+
/**
|
|
43
|
+
* Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
|
|
46
|
+
*/
|
|
47
|
+
mainFields?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Array of strings indicating what conditions should be used for module resolution.
|
|
50
|
+
*/
|
|
51
|
+
conditions?: string[];
|
|
52
|
+
/**
|
|
53
|
+
* Array of strings indicating what file extensions should be used for module resolution.
|
|
54
|
+
*
|
|
55
|
+
* @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
|
|
56
|
+
*/
|
|
57
|
+
extensions?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Array of strings indicating what modules should be deduplicated to a single version in the build.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts.
|
|
63
|
+
*/
|
|
64
|
+
dedupe?: string[];
|
|
65
|
+
/**
|
|
66
|
+
* Array of strings or regular expressions that indicate what modules are builtin for the environment.
|
|
67
|
+
*/
|
|
68
|
+
builtins?: (string | RegExp)[];
|
|
69
|
+
/**
|
|
70
|
+
* Define global variable replacements.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* {
|
|
78
|
+
* define: {
|
|
79
|
+
* __VERSION__: '"1.0.0"',
|
|
80
|
+
* __DEV__: 'process.env.NODE_ENV !== "production"'
|
|
81
|
+
* }
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @see https://esbuild.github.io/api/#define
|
|
86
|
+
* @see https://vitejs.dev/config/build-options.html#define
|
|
87
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/replace
|
|
88
|
+
*/
|
|
89
|
+
define?: Record<string, any>;
|
|
90
|
+
/**
|
|
91
|
+
* Global variables that will have import statements injected where necessary
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
* This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* {
|
|
99
|
+
* inject: {
|
|
100
|
+
* process: 'process/browser',
|
|
101
|
+
* Buffer: ['buffer', 'Buffer'],
|
|
102
|
+
* }
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/inject
|
|
107
|
+
*/
|
|
108
|
+
inject?: Record<string, string | string[]>;
|
|
30
109
|
/**
|
|
31
110
|
* The alias mappings to use for module resolution during the build process.
|
|
32
111
|
*
|
|
@@ -42,8 +121,13 @@ interface BuildConfig {
|
|
|
42
121
|
* }
|
|
43
122
|
* }
|
|
44
123
|
* ```
|
|
124
|
+
*
|
|
125
|
+
* @see https://github.com/rollup/plugins/tree/master/packages/alias
|
|
45
126
|
*/
|
|
46
|
-
alias?: Record<string, string
|
|
127
|
+
alias?: Record<string, string> | Array<{
|
|
128
|
+
find: string | RegExp;
|
|
129
|
+
replacement: string;
|
|
130
|
+
}>;
|
|
47
131
|
/**
|
|
48
132
|
* A list of modules that should not be bundled, even if they are external dependencies.
|
|
49
133
|
*
|
|
@@ -60,13 +144,14 @@ interface BuildConfig {
|
|
|
60
144
|
*/
|
|
61
145
|
skipNodeModulesBundle?: boolean;
|
|
62
146
|
/**
|
|
63
|
-
*
|
|
147
|
+
* An optional set of override options to apply to the selected build variant.
|
|
64
148
|
*
|
|
65
|
-
* @
|
|
149
|
+
* @remarks
|
|
150
|
+
* This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
|
|
66
151
|
*/
|
|
67
|
-
|
|
152
|
+
override?: Record<string, any>;
|
|
68
153
|
}
|
|
69
|
-
type BuildResolvedConfig = BuildConfig
|
|
154
|
+
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
70
155
|
type ViteBuildConfig = Omit<UserConfig$1, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig;
|
|
71
156
|
type ViteResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
|
|
72
157
|
|
|
@@ -134,11 +219,8 @@ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
|
|
|
134
219
|
tsconfigFilePath: string;
|
|
135
220
|
};
|
|
136
221
|
|
|
137
|
-
declare const
|
|
138
|
-
declare const __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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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) =>
|
|
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
|
-
*
|
|
481
|
-
*
|
|
482
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
576
|
+
* Formats a path to match the virtual file system (VFS) structure.
|
|
483
577
|
*
|
|
484
|
-
* @param path - The path to
|
|
485
|
-
* @returns The
|
|
578
|
+
* @param path - The path to format.
|
|
579
|
+
* @returns The formatted path.
|
|
486
580
|
*/
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Resolves a package name based on TypeScript's `tsconfig.json` paths.
|
|
490
|
-
*
|
|
491
|
-
* @see https://www.typescriptlang.org/tsconfig#paths
|
|
492
|
-
*
|
|
493
|
-
* @param path - The path to check.
|
|
494
|
-
* @returns The resolved package name if it exists, otherwise undefined.
|
|
495
|
-
*/
|
|
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
|
-
*
|
|
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.
|
|
516
|
-
*/
|
|
517
|
-
[__VFS_VIRTUAL__]: Volume;
|
|
518
|
-
/**
|
|
519
|
-
* A reference to the underlying unified file system.
|
|
590
|
+
* Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
|
|
520
591
|
*/
|
|
521
|
-
|
|
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
|
-
*
|
|
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,17 +850,29 @@ 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
|
-
|
|
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
874
|
type ViteUserConfig = UserConfig<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
|
|
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
|
*
|
|
@@ -907,14 +982,6 @@ interface MetaInfo {
|
|
|
907
982
|
* A hash that represents the path to the project root directory
|
|
908
983
|
*/
|
|
909
984
|
configHash: string;
|
|
910
|
-
/**
|
|
911
|
-
* A mapping of runtime ids to their corresponding file paths
|
|
912
|
-
*/
|
|
913
|
-
builtinIdMap: Record<string, string>;
|
|
914
|
-
/**
|
|
915
|
-
* A mapping of virtual file paths to their corresponding file contents
|
|
916
|
-
*/
|
|
917
|
-
virtualFiles: Record<string, string | null>;
|
|
918
985
|
}
|
|
919
986
|
interface Resolver extends Jiti {
|
|
920
987
|
plugin: Jiti;
|
|
@@ -927,7 +994,13 @@ interface InitContextOptions {
|
|
|
927
994
|
*/
|
|
928
995
|
isHighPriority: boolean;
|
|
929
996
|
}
|
|
930
|
-
|
|
997
|
+
/**
|
|
998
|
+
* The unresolved Powerlines context.
|
|
999
|
+
*
|
|
1000
|
+
* @remarks
|
|
1001
|
+
* This context is used before the user configuration has been fully resolved after the `config`.
|
|
1002
|
+
*/
|
|
1003
|
+
interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
931
1004
|
/**
|
|
932
1005
|
* The Storm workspace configuration
|
|
933
1006
|
*/
|
|
@@ -935,7 +1008,10 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
935
1008
|
/**
|
|
936
1009
|
* An object containing the options provided to Powerlines
|
|
937
1010
|
*/
|
|
938
|
-
config: TResolvedConfig
|
|
1011
|
+
config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
|
|
1012
|
+
projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
|
|
1013
|
+
output: TResolvedConfig["output"];
|
|
1014
|
+
};
|
|
939
1015
|
/**
|
|
940
1016
|
* A logging function for the Powerlines engine
|
|
941
1017
|
*/
|
|
@@ -1092,6 +1168,12 @@ interface Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
|
1092
1168
|
*/
|
|
1093
1169
|
extendLog: (name: string) => LogFn;
|
|
1094
1170
|
}
|
|
1171
|
+
type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
|
|
1172
|
+
/**
|
|
1173
|
+
* The fully resolved Powerlines configuration
|
|
1174
|
+
*/
|
|
1175
|
+
config: TResolvedConfig;
|
|
1176
|
+
};
|
|
1095
1177
|
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
|
|
1096
1178
|
/**
|
|
1097
1179
|
* The environment specific resolved configuration
|
|
@@ -1107,7 +1189,7 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
1107
1189
|
}
|
|
1108
1190
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = PluginContext<TResolvedConfig> & Omit<UnpluginBuildContext, "parse">;
|
|
1109
1191
|
|
|
1110
|
-
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "
|
|
1192
|
+
declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
|
|
1111
1193
|
type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
|
|
1112
1194
|
|
|
1113
1195
|
interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
|
|
@@ -1132,6 +1214,10 @@ interface GenerateTypesResult {
|
|
|
1132
1214
|
directives?: string[];
|
|
1133
1215
|
code: string;
|
|
1134
1216
|
}
|
|
1217
|
+
type DeepPartial<T> = {
|
|
1218
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
1219
|
+
};
|
|
1220
|
+
type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial<TContext["config"]> & Record<string, any>;
|
|
1135
1221
|
interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
|
|
1136
1222
|
/**
|
|
1137
1223
|
* A function that returns configuration options to be merged with the build context's options.
|
|
@@ -1147,7 +1233,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
|
|
|
1147
1233
|
* @param config - The partial configuration object to be modified.
|
|
1148
1234
|
* @returns A promise that resolves to a partial configuration object.
|
|
1149
1235
|
*/
|
|
1150
|
-
config: (this:
|
|
1236
|
+
config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
|
|
1151
1237
|
/**
|
|
1152
1238
|
* 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.
|
|
1153
1239
|
*
|
|
@@ -1250,7 +1336,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
|
|
|
1250
1336
|
* @param config - The partial configuration object to be modified.
|
|
1251
1337
|
* @returns A promise that resolves to a partial configuration object.
|
|
1252
1338
|
*/
|
|
1253
|
-
config: PluginHook<(this:
|
|
1339
|
+
config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
|
|
1254
1340
|
/**
|
|
1255
1341
|
* A hook that is called to transform the source code.
|
|
1256
1342
|
*
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-
|
|
2
|
-
export { b as VitePluginResolvedConfig } from './index-
|
|
1
|
+
import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-BMkoiiHF.cjs';
|
|
2
|
+
export { b as VitePluginResolvedConfig } from './index-BMkoiiHF.cjs';
|
|
3
3
|
export { createVitePlugin } from './helpers/unplugin.cjs';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/base';
|
|
6
7
|
import '@stryke/types/package-json';
|
|
7
8
|
import 'jiti';
|
|
8
9
|
import 'oxc-parser';
|
|
@@ -11,16 +12,13 @@ import 'unplugin';
|
|
|
11
12
|
import '@storm-software/build-tools/types';
|
|
12
13
|
import '@storm-software/config-tools/types';
|
|
13
14
|
import '@storm-software/config/types';
|
|
14
|
-
import '@stryke/types/base';
|
|
15
15
|
import '@stryke/types/configuration';
|
|
16
16
|
import '@stryke/types/file';
|
|
17
17
|
import '@stryke/types/array';
|
|
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
|
|
|
25
23
|
/**
|
|
26
24
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-
|
|
2
|
-
export { b as VitePluginResolvedConfig } from './index-
|
|
1
|
+
import { V as VitePluginContext, a as VitePluginOptions, P as Plugin } from './index-BMkoiiHF.js';
|
|
2
|
+
export { b as VitePluginResolvedConfig } from './index-BMkoiiHF.js';
|
|
3
3
|
export { createVitePlugin } from './helpers/unplugin.js';
|
|
4
4
|
import 'vite';
|
|
5
5
|
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/base';
|
|
6
7
|
import '@stryke/types/package-json';
|
|
7
8
|
import 'jiti';
|
|
8
9
|
import 'oxc-parser';
|
|
@@ -11,16 +12,13 @@ import 'unplugin';
|
|
|
11
12
|
import '@storm-software/build-tools/types';
|
|
12
13
|
import '@storm-software/config-tools/types';
|
|
13
14
|
import '@storm-software/config/types';
|
|
14
|
-
import '@stryke/types/base';
|
|
15
15
|
import '@stryke/types/configuration';
|
|
16
16
|
import '@stryke/types/file';
|
|
17
17
|
import '@stryke/types/array';
|
|
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
|
|
|
25
23
|
/**
|
|
26
24
|
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-
|
|
1
|
+
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-BMkoiiHF.cjs';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/base';
|
|
4
5
|
import '@stryke/types/package-json';
|
|
5
6
|
import 'jiti';
|
|
6
7
|
import 'oxc-parser';
|
|
@@ -9,13 +10,10 @@ import 'unplugin';
|
|
|
9
10
|
import '@storm-software/build-tools/types';
|
|
10
11
|
import '@storm-software/config-tools/types';
|
|
11
12
|
import '@storm-software/config/types';
|
|
12
|
-
import '@stryke/types/base';
|
|
13
13
|
import '@stryke/types/configuration';
|
|
14
14
|
import '@stryke/types/file';
|
|
15
15
|
import '@stryke/types/array';
|
|
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';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-
|
|
1
|
+
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-BMkoiiHF.js';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/base';
|
|
4
5
|
import '@stryke/types/package-json';
|
|
5
6
|
import 'jiti';
|
|
6
7
|
import 'oxc-parser';
|
|
@@ -9,13 +10,10 @@ import 'unplugin';
|
|
|
9
10
|
import '@storm-software/build-tools/types';
|
|
10
11
|
import '@storm-software/config-tools/types';
|
|
11
12
|
import '@storm-software/config/types';
|
|
12
|
-
import '@stryke/types/base';
|
|
13
13
|
import '@stryke/types/configuration';
|
|
14
14
|
import '@stryke/types/file';
|
|
15
15
|
import '@stryke/types/array';
|
|
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';
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-
|
|
1
|
+
export { V as VitePluginContext, a as VitePluginOptions, b as VitePluginResolvedConfig } from '../index-BMkoiiHF.cjs';
|
|
2
2
|
import 'vite';
|
|
3
3
|
import '@stryke/env/get-env-paths';
|
|
4
|
+
import '@stryke/types/base';
|
|
4
5
|
import '@stryke/types/package-json';
|
|
5
6
|
import 'jiti';
|
|
6
7
|
import 'oxc-parser';
|
|
@@ -9,13 +10,10 @@ import 'unplugin';
|
|
|
9
10
|
import '@storm-software/build-tools/types';
|
|
10
11
|
import '@storm-software/config-tools/types';
|
|
11
12
|
import '@storm-software/config/types';
|
|
12
|
-
import '@stryke/types/base';
|
|
13
13
|
import '@stryke/types/configuration';
|
|
14
14
|
import '@stryke/types/file';
|
|
15
15
|
import '@stryke/types/array';
|
|
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';
|