@powerlines/plugin-deepkit 0.11.49 → 0.11.51

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.
@@ -0,0 +1,2179 @@
1
+ import "node:module";
2
+ import { ArrayValues } from "@stryke/types/array";
3
+ import { AnyFunction, MaybePromise, NonUndefined } from "@stryke/types/base";
4
+ import { LoadResult, OutputOptions, RollupOptions } from "rollup";
5
+ import { ExternalIdResult, HookFilter, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage, UnpluginOptions } from "unplugin";
6
+ import { UserConfig } from "@farmfe/core";
7
+ import { Configuration } from "@rspack/core";
8
+ import { BuildOptions } from "@storm-software/tsup/types";
9
+ import { UnbuildOptions } from "@storm-software/unbuild/types";
10
+ import { BuildOptions as BuildOptions$1 } from "esbuild";
11
+ import { RolldownOptions } from "rolldown";
12
+ import { UserConfig as UserConfig$1 } from "tsdown";
13
+ import { DepOptimizationOptions, PreviewOptions, ResolvedPreviewOptions, UserConfig as UserConfig$2 } from "vite";
14
+ import { Configuration as Configuration$1 } from "webpack";
15
+ import { EnvPaths } from "@stryke/env/get-env-paths";
16
+ import { FetchRequestOptions } from "@stryke/http/fetch";
17
+ import { PackageJson } from "@stryke/types/package-json";
18
+ import { Jiti } from "jiti";
19
+ import { SourceMap } from "magic-string";
20
+ import { ParseResult, ParserOptions } from "oxc-parser";
21
+ import { Range } from "semver";
22
+ import { Project } from "ts-morph";
23
+ import { RequestInfo, Response } from "undici";
24
+ import { Format } from "@storm-software/build-tools/types";
25
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
26
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
27
+ import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
28
+ import { AssetGlob } from "@stryke/types/file";
29
+ import { DateString } from "compatx";
30
+ import { ResolveOptions } from "@stryke/fs/resolve";
31
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
32
+ import ts from "typescript";
33
+
34
+ //#region rolldown:runtime
35
+ //#endregion
36
+ //#region ../powerlines/src/types/build.d.ts
37
+ type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
38
+ type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
39
+ type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
40
+ interface BuildConfig {
41
+ /**
42
+ * The platform to build the project for
43
+ *
44
+ * @defaultValue "neutral"
45
+ */
46
+ platform?: "node" | "browser" | "neutral";
47
+ /**
48
+ * Array of strings indicating the polyfills to include for the build.
49
+ *
50
+ * @remarks
51
+ * 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).
52
+ *
53
+ * @example
54
+ * ```ts
55
+ * {
56
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
57
+ * }
58
+ * ```
59
+ */
60
+ polyfill?: string[];
61
+ /**
62
+ * 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.
63
+ *
64
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
65
+ */
66
+ mainFields?: string[];
67
+ /**
68
+ * Array of strings indicating what conditions should be used for module resolution.
69
+ */
70
+ conditions?: string[];
71
+ /**
72
+ * Array of strings indicating what file extensions should be used for module resolution.
73
+ *
74
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
75
+ */
76
+ extensions?: string[];
77
+ /**
78
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
79
+ *
80
+ * @remarks
81
+ * 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.
82
+ */
83
+ dedupe?: string[];
84
+ /**
85
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
86
+ */
87
+ builtins?: (string | RegExp)[];
88
+ /**
89
+ * Define global variable replacements.
90
+ *
91
+ * @remarks
92
+ * 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.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * {
97
+ * define: {
98
+ * __VERSION__: '"1.0.0"',
99
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
100
+ * }
101
+ * }
102
+ * ```
103
+ *
104
+ * @see https://esbuild.github.io/api/#define
105
+ * @see https://vitejs.dev/config/build-options.html#define
106
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
107
+ */
108
+ define?: Record<string, any>;
109
+ /**
110
+ * Global variables that will have import statements injected where necessary
111
+ *
112
+ * @remarks
113
+ * 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.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * {
118
+ * inject: {
119
+ * process: 'process/browser',
120
+ * Buffer: ['buffer', 'Buffer'],
121
+ * }
122
+ * }
123
+ * ```
124
+ *
125
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
126
+ */
127
+ inject?: Record<string, string | string[]>;
128
+ /**
129
+ * The alias mappings to use for module resolution during the build process.
130
+ *
131
+ * @remarks
132
+ * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * {
137
+ * alias: {
138
+ * "@utils": "./src/utils",
139
+ * "@components": "./src/components"
140
+ * }
141
+ * }
142
+ * ```
143
+ *
144
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
145
+ */
146
+ alias?: Record<string, string> | Array<{
147
+ find: string | RegExp;
148
+ replacement: string;
149
+ }>;
150
+ /**
151
+ * A list of modules that should not be bundled, even if they are external dependencies.
152
+ *
153
+ * @remarks
154
+ * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
155
+ */
156
+ external?: (string | RegExp)[];
157
+ /**
158
+ * A list of modules that should always be bundled, even if they are external dependencies.
159
+ */
160
+ noExternal?: (string | RegExp)[];
161
+ /**
162
+ * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
163
+ */
164
+ skipNodeModulesBundle?: boolean;
165
+ /**
166
+ * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
167
+ *
168
+ * @defaultValue false
169
+ */
170
+ keepProcessEnv?: boolean;
171
+ /**
172
+ * An optional set of override options to apply to the selected build variant.
173
+ *
174
+ * @remarks
175
+ * 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.
176
+ */
177
+ override?: Record<string, any>;
178
+ }
179
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
180
+ type ESBuildBuildConfig = Omit<BuildOptions$1, "entryPoints" | "sourceRoot" | "platform" | "outdir" | "env" | "assets" | "external" | "inject" | "tsconfig" | "tsconfigRaw" | "logLevel"> & BuildConfig;
181
+ type ESBuildResolvedBuildConfig = Omit<BuildOptions$1, "inject"> & BuildResolvedConfig;
182
+ type ViteBuildConfig = Omit<UserConfig$2, "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw" | "environments" | "output"> & BuildConfig & {
183
+ /**
184
+ * Optimize deps config
185
+ */
186
+ optimizeDeps?: Omit<DepOptimizationOptions, "extensions">;
187
+ };
188
+ type ViteResolvedBuildConfig = UserConfig$2 & BuildResolvedConfig;
189
+ type WebpackBuildConfig = Omit<Configuration$1, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
190
+ type WebpackResolvedBuildConfig = Configuration$1 & BuildResolvedConfig;
191
+ type RspackBuildConfig = Omit<Configuration, "name" | "entry" | "entryPoints" | "tsconfig" | "tsconfigRaw"> & BuildConfig;
192
+ type RspackResolvedBuildConfig = Configuration & BuildResolvedConfig;
193
+ type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
194
+ type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
195
+ output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
196
+ } & BuildConfig;
197
+ type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
198
+ type RolldownBuildConfig = Omit<RolldownOptions, "input" | "external" | "tsconfig" | "logLevel" | "output"> & BuildConfig;
199
+ type RolldownResolvedBuildConfig = RolldownOptions & BuildResolvedConfig;
200
+ type TsupBuildConfig = Partial<Omit<BuildOptions, "userOptions" | "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "clean" | "env" | "entry" | "entryPoints" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
201
+ type TsupResolvedBuildConfig = BuildOptions & BuildResolvedConfig;
202
+ type TsdownBuildConfig = Partial<Omit<UserConfig$1, "name" | "outDir" | "clean" | "cwd" | "tsconfig" | "publicDir" | "copy" | "alias" | "format" | "platform" | "env" | "define" | "entry" | "external" | "noExternal" | "skipNodeModulesBundle">> & BuildConfig;
203
+ type TsdownResolvedBuildConfig = UserConfig$1 & BuildResolvedConfig;
204
+ type UnbuildBuildConfig = Partial<Omit<UnbuildOptions, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
205
+ type UnbuildResolvedBuildConfig = UnbuildOptions & BuildResolvedConfig;
206
+ type FarmBuildConfig = Partial<Omit<UserConfig, "tsconfig" | "tsconfigRaw" | "assets" | "outputPath" | "mode" | "format" | "platform" | "projectRoot" | "env" | "entry" | "entryPoints">> & BuildConfig;
207
+ type FarmResolvedBuildConfig = UserConfig & BuildResolvedConfig;
208
+ //#endregion
209
+ //#region ../powerlines/src/types/fs.d.ts
210
+ type StoragePreset = "fs" | "virtual";
211
+ /**
212
+ * Interface defining the methods and properties for a storage adapter.
213
+ */
214
+ interface StorageAdapter {
215
+ /**
216
+ * A name identifying the storage adapter type.
217
+ */
218
+ name: string;
219
+ /**
220
+ * The storage preset for the adapter.
221
+ *
222
+ * @remarks
223
+ * This can be used as an alternate way to identify the type of storage being used.
224
+ */
225
+ preset?: StoragePreset | null;
226
+ /**
227
+ * Checks if a key exists in the storage.
228
+ *
229
+ * @param key - The key to check for existence.
230
+ * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
231
+ */
232
+ exists: (key: string) => Promise<boolean>;
233
+ /**
234
+ * Synchronously checks if a key exists in the storage.
235
+ *
236
+ * @param key - The key to check for existence.
237
+ * @returns Returns `true` if the key exists, otherwise `false`.
238
+ */
239
+ existsSync: (key: string) => boolean;
240
+ /**
241
+ * Read a value associated with a key from the storage.
242
+ *
243
+ * @param key - The key to read the value for.
244
+ * @returns A promise that resolves to the value if found, otherwise `null`.
245
+ */
246
+ get: (key: string) => Promise<string | null>;
247
+ /**
248
+ * Synchronously reads the value associated with a key from the storage.
249
+ *
250
+ * @param key - The key to read the value for.
251
+ * @returns The value if found, otherwise `null`.
252
+ */
253
+ getSync: (key: string) => string | null;
254
+ /**
255
+ * Writes a value to the storage for the given key.
256
+ *
257
+ * @param key - The key to associate the value with.
258
+ * @param value - The value to store.
259
+ */
260
+ set: (key: string, value: string) => Promise<void>;
261
+ /**
262
+ * Synchronously writes a value to the storage for the given key.
263
+ *
264
+ * @param key - The key to associate the value with.
265
+ * @param value - The value to store.
266
+ */
267
+ setSync: (key: string, value: string) => void;
268
+ /**
269
+ * Removes a value from the storage.
270
+ *
271
+ * @param key - The key whose value should be removed.
272
+ */
273
+ remove: (key: string) => Promise<void>;
274
+ /**
275
+ * Synchronously removes a value from the storage.
276
+ *
277
+ * @param key - The key whose value should be removed.
278
+ */
279
+ removeSync: (key: string) => void;
280
+ /**
281
+ * Creates a directory at the specified path.
282
+ *
283
+ * @param dirPath - The path of the directory to create.
284
+ */
285
+ mkdir: (dirPath: string) => Promise<void>;
286
+ /**
287
+ * Synchronously creates a directory at the specified path.
288
+ *
289
+ * @param dirPath - The path of the directory to create.
290
+ */
291
+ mkdirSync: (dirPath: string) => void;
292
+ /**
293
+ * Remove all entries from the storage that match the provided base path.
294
+ *
295
+ * @param base - The base path or prefix to clear entries from.
296
+ */
297
+ clear: (base?: string) => Promise<void>;
298
+ /**
299
+ * Synchronously remove all entries from the storage that match the provided base path.
300
+ *
301
+ * @param base - The base path or prefix to clear entries from.
302
+ */
303
+ clearSync: (base?: string) => void;
304
+ /**
305
+ * Lists all keys under the provided base path.
306
+ *
307
+ * @param base - The base path or prefix to list keys from.
308
+ * @returns A promise resolving to the list of keys.
309
+ */
310
+ list: (base?: string) => Promise<string[]>;
311
+ /**
312
+ * Synchronously lists all keys under the provided base path.
313
+ *
314
+ * @param base - The base path or prefix to list keys from.
315
+ * @returns The list of keys.
316
+ */
317
+ listSync: (base?: string) => string[];
318
+ /**
319
+ * Checks if the given key is a directory.
320
+ *
321
+ * @param key - The key to check.
322
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
323
+ */
324
+ isDirectory: (key: string) => Promise<boolean>;
325
+ /**
326
+ * Synchronously checks if the given key is a directory.
327
+ *
328
+ * @param key - The key to check.
329
+ * @returns `true` if the key is a directory, otherwise `false`.
330
+ */
331
+ isDirectorySync: (key: string) => boolean;
332
+ /**
333
+ * Checks if the given key is a file.
334
+ *
335
+ * @param key - The key to check.
336
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
337
+ */
338
+ isFile: (key: string) => Promise<boolean>;
339
+ /**
340
+ * Synchronously checks if the given key is a file.
341
+ *
342
+ * @param key - The key to check.
343
+ * @returns `true` if the key is a file, otherwise `false`.
344
+ */
345
+ isFileSync: (key: string) => boolean;
346
+ /**
347
+ * Releases any resources held by the storage adapter.
348
+ */
349
+ dispose: () => MaybePromise<void>;
350
+ }
351
+ /**
352
+ * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
353
+ */
354
+ type StoragePort = Record<string, StorageAdapter>;
355
+ interface VirtualFileMetadata {
356
+ /**
357
+ * The identifier for the file data.
358
+ */
359
+ id: string;
360
+ /**
361
+ * The timestamp of the virtual file.
362
+ */
363
+ timestamp: number;
364
+ /**
365
+ * The type of the file.
366
+ *
367
+ * @remarks
368
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
369
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
370
+ * - `entry`: Indicates that the file is an entry point for execution.
371
+ * - `normal`: Indicates that the file is a standard file without any special role.
372
+ */
373
+ type: string;
374
+ /**
375
+ * Additional metadata associated with the file.
376
+ */
377
+ properties: Record<string, string | undefined>;
378
+ }
379
+ interface VirtualFileData {
380
+ /**
381
+ * The identifier for the file data.
382
+ */
383
+ id?: string;
384
+ /**
385
+ * The contents of the virtual file.
386
+ */
387
+ code: string;
388
+ /**
389
+ * The type of the file.
390
+ *
391
+ * @remarks
392
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
393
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
394
+ * - `entry`: Indicates that the file is an entry point for execution.
395
+ * - `normal`: Indicates that the file is a standard file without any special role.
396
+ */
397
+ type?: string;
398
+ /**
399
+ * Additional metadata associated with the file.
400
+ */
401
+ properties?: Record<string, string | undefined>;
402
+ }
403
+ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
404
+ /**
405
+ * An additional name for the file.
406
+ */
407
+ path: string;
408
+ /**
409
+ * The timestamp of the virtual file.
410
+ */
411
+ timestamp: number;
412
+ }
413
+ interface WriteOptions {
414
+ /**
415
+ * Should the file skip formatting before being written?
416
+ *
417
+ * @defaultValue false
418
+ */
419
+ skipFormat?: boolean;
420
+ /**
421
+ * The storage preset or adapter name for the output file.
422
+ *
423
+ * @remarks
424
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
425
+ */
426
+ storage?: StoragePreset | string;
427
+ /**
428
+ * Additional metadata for the file.
429
+ */
430
+ meta?: Partial<VirtualFileMetadata>;
431
+ }
432
+ interface ResolveOptions$1 extends ResolveOptions {
433
+ /**
434
+ * If true, the module is being resolved as an entry point.
435
+ */
436
+ isEntry?: boolean;
437
+ /**
438
+ * If true, the resolver will skip alias resolution when resolving modules.
439
+ */
440
+ skipAlias?: boolean;
441
+ /**
442
+ * If true, the resolver will skip using the cache when resolving modules.
443
+ */
444
+ skipCache?: boolean;
445
+ /**
446
+ * An array of external modules or patterns to exclude from resolution.
447
+ */
448
+ external?: (string | RegExp)[];
449
+ /**
450
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
451
+ */
452
+ noExternal?: (string | RegExp)[];
453
+ /**
454
+ * An array of patterns to match when resolving modules.
455
+ */
456
+ skipNodeModulesBundle?: boolean;
457
+ }
458
+ interface VirtualFileSystemInterface {
459
+ /**
460
+ * The underlying file metadata.
461
+ */
462
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
463
+ /**
464
+ * A map of file paths to their module ids.
465
+ */
466
+ ids: Readonly<Record<string, string>>;
467
+ /**
468
+ * A map of module ids to their file paths.
469
+ */
470
+ paths: Readonly<Record<string, string>>;
471
+ /**
472
+ * Checks if a file exists in the virtual file system (VFS).
473
+ *
474
+ * @param path - The path or id of the file.
475
+ * @returns `true` if the file exists, otherwise `false`.
476
+ */
477
+ exists: (path: string) => Promise<boolean>;
478
+ /**
479
+ * Synchronously Checks if a file exists in the virtual file system (VFS).
480
+ *
481
+ * @param path - The path or id of the file.
482
+ * @returns `true` if the file exists, otherwise `false`.
483
+ */
484
+ existsSync: (path: string) => boolean;
485
+ /**
486
+ * Checks if a file is virtual in the virtual file system (VFS).
487
+ *
488
+ * @param path - The path or id of the file.
489
+ * @returns `true` if the file is virtual, otherwise `false`.
490
+ */
491
+ isVirtual: (path: string) => boolean;
492
+ /**
493
+ * Checks if the given key is a directory.
494
+ *
495
+ * @param key - The key to check.
496
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
497
+ */
498
+ isDirectory: (key: string) => Promise<boolean>;
499
+ /**
500
+ * Synchronously checks if the given key is a directory.
501
+ *
502
+ * @param key - The key to check.
503
+ * @returns `true` if the key is a directory, otherwise `false`.
504
+ */
505
+ isDirectorySync: (key: string) => boolean;
506
+ /**
507
+ * Checks if the given key is a file.
508
+ *
509
+ * @param key - The key to check.
510
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
511
+ */
512
+ isFile: (key: string) => Promise<boolean>;
513
+ /**
514
+ * Synchronously checks if the given key is a file.
515
+ *
516
+ * @param key - The key to check.
517
+ * @returns `true` if the key is a file, otherwise `false`.
518
+ */
519
+ isFileSync: (key: string) => boolean;
520
+ /**
521
+ * Gets the metadata of a file in the virtual file system (VFS).
522
+ *
523
+ * @param path - The path or id of the file.
524
+ * @returns The metadata of the file if it exists, otherwise undefined.
525
+ */
526
+ getMetadata: (path: string) => VirtualFileMetadata | undefined;
527
+ /**
528
+ * Lists files in a given path.
529
+ *
530
+ * @param path - The path to list files from.
531
+ * @returns An array of file names in the specified path.
532
+ */
533
+ listSync: (path: string) => string[];
534
+ /**
535
+ * Lists files in a given path.
536
+ *
537
+ * @param path - The path to list files from.
538
+ * @returns An array of file names in the specified path.
539
+ */
540
+ list: (path: string) => Promise<string[]>;
541
+ /**
542
+ * Removes a file or symbolic link in the virtual file system (VFS).
543
+ *
544
+ * @param path - The path to the file to remove.
545
+ * @returns A promise that resolves when the file is removed.
546
+ */
547
+ removeSync: (path: string) => void;
548
+ /**
549
+ * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
550
+ *
551
+ * @param path - The path to the file to remove.
552
+ * @returns A promise that resolves when the file is removed.
553
+ */
554
+ remove: (path: string) => Promise<void>;
555
+ /**
556
+ * Reads a file from the virtual file system (VFS).
557
+ *
558
+ * @param path - The path or id of the file.
559
+ * @returns The contents of the file if it exists, otherwise undefined.
560
+ */
561
+ read: (path: string) => Promise<string | undefined>;
562
+ /**
563
+ * Reads a file from the virtual file system (VFS).
564
+ *
565
+ * @param path - The path or id of the file.
566
+ */
567
+ readSync: (path: string) => string | undefined;
568
+ /**
569
+ * Writes a file to the virtual file system (VFS).
570
+ *
571
+ * @param path - The path to the file.
572
+ * @param data - The contents of the file.
573
+ * @param options - Options for writing the file.
574
+ * @returns A promise that resolves when the file is written.
575
+ */
576
+ write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
577
+ /**
578
+ * Writes a file to the virtual file system (VFS).
579
+ *
580
+ * @param path - The path to the file.
581
+ * @param data - The contents of the file.
582
+ * @param options - Options for writing the file.
583
+ */
584
+ writeSync: (path: string, data: string, options?: WriteOptions) => void;
585
+ /**
586
+ * Creates a directory at the specified path.
587
+ *
588
+ * @param dirPath - The path of the directory to create.
589
+ */
590
+ mkdir: (dirPath: string) => Promise<void>;
591
+ /**
592
+ * Synchronously creates a directory at the specified path.
593
+ *
594
+ * @param dirPath - The path of the directory to create.
595
+ */
596
+ mkdirSync: (dirPath: string) => void;
597
+ /**
598
+ * Moves a file from one path to another in the virtual file system (VFS).
599
+ *
600
+ * @param srcPath - The source path to move
601
+ * @param destPath - The destination path to move to
602
+ */
603
+ move: (srcPath: string, destPath: string) => Promise<void>;
604
+ /**
605
+ * Synchronously moves a file from one path to another in the virtual file system (VFS).
606
+ *
607
+ * @param srcPath - The source path to move
608
+ * @param destPath - The destination path to move to
609
+ */
610
+ moveSync: (srcPath: string, destPath: string) => void;
611
+ /**
612
+ * Copies a file from one path to another in the virtual file system (VFS).
613
+ *
614
+ * @param srcPath - The source path to copy
615
+ * @param destPath - The destination path to copy to
616
+ */
617
+ copy: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => Promise<void>;
618
+ /**
619
+ * Synchronously copies a file from one path to another in the virtual file system (VFS).
620
+ *
621
+ * @param srcPath - The source path to copy
622
+ * @param destPath - The destination path to copy to
623
+ */
624
+ copySync: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => void;
625
+ /**
626
+ * Glob files in the virtual file system (VFS) based on the provided pattern(s).
627
+ *
628
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
629
+ * @returns An array of file paths matching the provided pattern(s)
630
+ */
631
+ glob: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => Promise<string[]>;
632
+ /**
633
+ * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
634
+ *
635
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
636
+ * @returns An array of file paths matching the provided pattern(s)
637
+ */
638
+ globSync: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => string[];
639
+ /**
640
+ * A helper function to resolve modules using the Jiti resolver
641
+ *
642
+ * @remarks
643
+ * This function can be used to resolve modules relative to the project root directory.
644
+ *
645
+ * @example
646
+ * ```ts
647
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
648
+ * ```
649
+ *
650
+ * @param id - The module to resolve.
651
+ * @param importer - An optional path to the importer module.
652
+ * @param options - Additional resolution options.
653
+ * @returns A promise that resolves to the resolved module path.
654
+ */
655
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<string | undefined>;
656
+ /**
657
+ * A synchronous helper function to resolve modules using the Jiti resolver
658
+ *
659
+ * @remarks
660
+ * This function can be used to resolve modules relative to the project root directory.
661
+ *
662
+ * @example
663
+ * ```ts
664
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
665
+ * ```
666
+ *
667
+ * @param id - The module to resolve.
668
+ * @param importer - An optional path to the importer module.
669
+ * @param options - Additional resolution options.
670
+ * @returns The resolved module path.
671
+ */
672
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
673
+ /**
674
+ * Resolves a given module ID using the configured aliases.
675
+ *
676
+ * @remarks
677
+ * This function can be used to map module IDs to different paths based on the alias configuration.
678
+ *
679
+ * @param id - The module ID to resolve.
680
+ * @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
681
+ */
682
+ resolveAlias: (id: string) => string;
683
+ /**
684
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
685
+ */
686
+ dispose: () => Promise<void>;
687
+ }
688
+ //#endregion
689
+ //#region ../powerlines/src/types/tsconfig.d.ts
690
+ type ReflectionMode = "default" | "explicit" | "never";
691
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
692
+ /**
693
+ * Defines the level of reflection to be used during the transpilation process.
694
+ *
695
+ * @remarks
696
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
697
+ * - `minimal` - Only the essential type information is captured.
698
+ * - `normal` - Additional type information is captured, including some contextual data.
699
+ * - `verbose` - All available type information is captured, including detailed contextual data.
700
+ */
701
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
702
+ interface DeepkitOptions {
703
+ /**
704
+ * Either true to activate reflection for all files compiled using this tsconfig,
705
+ * or a list of globs/file paths relative to this tsconfig.json.
706
+ * Globs/file paths can be prefixed with a ! to exclude them.
707
+ */
708
+ reflection?: RawReflectionMode;
709
+ /**
710
+ * Defines the level of reflection to be used during the transpilation process.
711
+ *
712
+ * @remarks
713
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
714
+ * - `minimal` - Only the essential type information is captured.
715
+ * - `normal` - Additional type information is captured, including some contextual data.
716
+ * - `verbose` - All available type information is captured, including detailed contextual data.
717
+ */
718
+ reflectionLevel?: ReflectionLevel;
719
+ }
720
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
721
+ /**
722
+ * The TypeScript compiler configuration.
723
+ *
724
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
725
+ */
726
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
727
+ /**
728
+ * Either true to activate reflection for all files compiled using this tsconfig,
729
+ * or a list of globs/file paths relative to this tsconfig.json.
730
+ * Globs/file paths can be prefixed with a ! to exclude them.
731
+ */
732
+ reflection?: RawReflectionMode;
733
+ /**
734
+ * Defines the level of reflection to be used during the transpilation process.
735
+ *
736
+ * @remarks
737
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
738
+ * - `minimal` - Only the essential type information is captured.
739
+ * - `normal` - Additional type information is captured, including some contextual data.
740
+ * - `verbose` - All available type information is captured, including detailed contextual data.
741
+ */
742
+ reflectionLevel?: ReflectionLevel;
743
+ /**
744
+ * Instructs the TypeScript compiler how to compile `.ts` files.
745
+ */
746
+ compilerOptions?: TSCompilerOptions;
747
+ }
748
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
749
+ originalTsconfigJson: TsConfigJson;
750
+ tsconfigJson: TSConfig;
751
+ tsconfigFilePath: string;
752
+ };
753
+ //#endregion
754
+ //#region ../powerlines/src/types/config.d.ts
755
+ type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
756
+ /**
757
+ * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
758
+ */
759
+ type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
760
+ type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext> | Plugin<TContext>[]>;
761
+ /**
762
+ * A configuration tuple for a Powerlines plugin.
763
+ */
764
+ type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
765
+ /**
766
+ * A configuration object for a Powerlines plugin.
767
+ */
768
+ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
769
+ plugin: string | PluginFactory<TContext, TOptions>;
770
+ options: TOptions;
771
+ } | {
772
+ plugin: Plugin<TContext>;
773
+ options?: never;
774
+ };
775
+ /**
776
+ * A configuration tuple for a Powerlines plugin.
777
+ */
778
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
779
+ type ProjectType = "application" | "library";
780
+ interface DeployConfig {
781
+ /**
782
+ * The deployment variant being used by the Powerlines engine.
783
+ *
784
+ * @example
785
+ * ```ts
786
+ * export default defineConfig({
787
+ * deploy: {
788
+ * variant: "cloudflare"
789
+ * }
790
+ * });
791
+ *
792
+ * ```
793
+ */
794
+ variant?: string;
795
+ }
796
+ interface OutputConfig {
797
+ /**
798
+ * The path to output the final compiled files to
799
+ *
800
+ * @remarks
801
+ * If a value is not provided, Powerlines will attempt to:
802
+ * 1. Use the `outDir` value in the `tsconfig.json` file.
803
+ * 2. Use the `dist` directory in the project root directory.
804
+ *
805
+ * @defaultValue "dist/\{projectRoot\}"
806
+ */
807
+ outputPath?: string;
808
+ /**
809
+ * The output directory path for the project build.
810
+ *
811
+ * @remarks
812
+ * This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
813
+ *
814
+ * @defaultValue "\{projectRoot\}/dist"
815
+ */
816
+ buildPath?: string;
817
+ /**
818
+ * The folder where the generated runtime artifacts will be located
819
+ *
820
+ * @remarks
821
+ * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
822
+ *
823
+ * @defaultValue "\{projectRoot\}/.powerlines"
824
+ */
825
+ artifactsPath?: string;
826
+ /**
827
+ * The path of the generated runtime declaration file relative to the workspace root.
828
+ *
829
+ * @defaultValue "\{projectRoot\}/powerlines.d.ts"
830
+ */
831
+ dts?: string | false;
832
+ /**
833
+ * A prefix to use for identifying builtin modules
834
+ *
835
+ * @remarks
836
+ * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
837
+ *
838
+ * @defaultValue "powerlines"
839
+ */
840
+ builtinPrefix?: string;
841
+ /**
842
+ * The module format of the output files
843
+ *
844
+ * @remarks
845
+ * This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
846
+ *
847
+ * @defaultValue "esm"
848
+ */
849
+ format?: Format | Format[];
850
+ /**
851
+ * A list of assets to copy to the output directory
852
+ *
853
+ * @remarks
854
+ * The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
855
+ */
856
+ assets?: Array<string | AssetGlob>;
857
+ /**
858
+ * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
859
+ *
860
+ * @remarks
861
+ * If a string preset is provided, it must be one of the following values:
862
+ * - `"virtual"`: Uses the local file system for storage.
863
+ * - `"fs"`: Uses an in-memory virtual file system for storage.
864
+ *
865
+ * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
866
+ *
867
+ * @defaultValue "virtual"
868
+ */
869
+ storage?: StoragePort | StoragePreset;
870
+ }
871
+ interface BaseConfig {
872
+ /**
873
+ * The entry point(s) for the application
874
+ */
875
+ entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
876
+ /**
877
+ * Configuration for the output of the build process
878
+ */
879
+ output?: OutputConfig;
880
+ /**
881
+ * Configuration for cleaning the build artifacts
882
+ *
883
+ * @remarks
884
+ * If set to `false`, the cleaning process will be disabled.
885
+ */
886
+ clean?: Record<string, any> | false;
887
+ /**
888
+ * Configuration for linting the source code
889
+ *
890
+ * @remarks
891
+ * If set to `false`, linting will be disabled.
892
+ */
893
+ lint?: Record<string, any> | false;
894
+ /**
895
+ * Configuration for testing the source code
896
+ *
897
+ * @remarks
898
+ * If set to `false`, testing will be disabled.
899
+ */
900
+ test?: Record<string, any> | false;
901
+ /**
902
+ * Configuration for the transformation of the source code
903
+ */
904
+ transform?: Record<string, any>;
905
+ /**
906
+ * Configuration provided to build processes
907
+ *
908
+ * @remarks
909
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
910
+ */
911
+ build?: BuildConfig;
912
+ /**
913
+ * Configuration for documentation generation
914
+ *
915
+ * @remarks
916
+ * This configuration will be used by the documentation generation plugins during the `docs` command.
917
+ */
918
+ docs?: Record<string, any>;
919
+ /**
920
+ * Configuration for deploying the source code
921
+ *
922
+ * @remarks
923
+ * If set to `false`, the deployment will be disabled.
924
+ */
925
+ deploy?: DeployConfig | false;
926
+ /**
927
+ * The path to the tsconfig file to be used by the compiler
928
+ *
929
+ * @remarks
930
+ * If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
931
+ *
932
+ * @defaultValue "\{projectRoot\}/tsconfig.json"
933
+ */
934
+ tsconfig?: string;
935
+ /**
936
+ * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
937
+ *
938
+ * @see https://www.typescriptlang.org/tsconfig
939
+ *
940
+ * @remarks
941
+ * If populated, this option takes higher priority than `tsconfig`
942
+ */
943
+ tsconfigRaw?: TSConfig;
944
+ }
945
+ interface EnvironmentConfig extends BaseConfig {
946
+ /**
947
+ * Configuration options for the preview server
948
+ */
949
+ preview?: PreviewOptions;
950
+ /**
951
+ * A flag indicating whether the build is for a Server-Side Rendering environment.
952
+ */
953
+ ssr?: boolean;
954
+ /**
955
+ * Define if this environment is used for Server-Side Rendering
956
+ *
957
+ * @defaultValue "server" (if it isn't the client environment)
958
+ */
959
+ consumer?: "client" | "server";
960
+ }
961
+ interface CommonUserConfig extends BaseConfig {
962
+ /**
963
+ * The name of the project
964
+ */
965
+ name?: string;
966
+ /**
967
+ * The project display title
968
+ *
969
+ * @remarks
970
+ * This option is used in documentation generation and other places where a human-readable title is needed.
971
+ */
972
+ title?: string;
973
+ /**
974
+ * A description of the project
975
+ *
976
+ * @remarks
977
+ * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
978
+ */
979
+ description?: string;
980
+ /**
981
+ * The organization or author of the project
982
+ *
983
+ * @remarks
984
+ * If this option is not provided, the build process will try to use the \`author\` value from the \`package.json\` file. If the \`author\` value cannot be determined, the {@link name | name configuration} will be used.
985
+ */
986
+ organization?: string;
987
+ /**
988
+ * The date to use for compatibility checks
989
+ *
990
+ * @remarks
991
+ * This date can be used by plugins and build processes to determine compatibility with certain features or APIs. It is recommended to set this date to the date when the project was last known to be compatible with the desired features or APIs.
992
+ *
993
+ * @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
994
+ * @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
995
+ * @see https://github.com/unjs/compatx
996
+ */
997
+ compatibilityDate?: DateString;
998
+ /**
999
+ * The log level to use for the Powerlines processes.
1000
+ *
1001
+ * @defaultValue "info"
1002
+ */
1003
+ logLevel?: LogLevelLabel | null;
1004
+ /**
1005
+ * A custom logger function to use for logging messages
1006
+ */
1007
+ customLogger?: LogFn;
1008
+ /**
1009
+ * Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
1010
+ *
1011
+ * @defaultValue "production"
1012
+ */
1013
+ mode?: "development" | "test" | "production";
1014
+ /**
1015
+ * The type of project being built
1016
+ *
1017
+ * @defaultValue "application"
1018
+ */
1019
+ type?: ProjectType;
1020
+ /**
1021
+ * The root directory of the project
1022
+ */
1023
+ root: string;
1024
+ /**
1025
+ * The root directory of the project's source code
1026
+ *
1027
+ * @defaultValue "\{root\}/src"
1028
+ */
1029
+ sourceRoot?: string;
1030
+ /**
1031
+ * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
1032
+ *
1033
+ * @remarks
1034
+ * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
1035
+ */
1036
+ configFile?: string;
1037
+ /**
1038
+ * Should the Powerlines processes automatically install missing package dependencies?
1039
+ *
1040
+ * @remarks
1041
+ * When set to `true`, Powerlines will attempt to install any missing dependencies using the package manager detected in the project (e.g., npm, yarn, pnpm). This can be useful for ensuring that all required packages are available during the build and preparation phases.
1042
+ *
1043
+ * @defaultValue false
1044
+ */
1045
+ autoInstall?: boolean;
1046
+ /**
1047
+ * Should the compiler processes skip any improvements that make use of cache?
1048
+ *
1049
+ * @defaultValue false
1050
+ */
1051
+ skipCache?: boolean;
1052
+ /**
1053
+ * A list of resolvable paths to plugins used during the build process
1054
+ */
1055
+ plugins?: PluginConfig<any>[];
1056
+ /**
1057
+ * Environment-specific configurations
1058
+ */
1059
+ environments?: Record<string, EnvironmentConfig>;
1060
+ /**
1061
+ * Should a single `build` process be ran for each environment?
1062
+ *
1063
+ * @remarks
1064
+ * This option determines how environments are managed during the `build` process. The available options are:
1065
+ *
1066
+ * - `false`: A separate build is ran for each environment.
1067
+ * - `true`: A single build is ran for all environments.
1068
+ *
1069
+ * @defaultValue false
1070
+ */
1071
+ singleBuild?: boolean;
1072
+ /**
1073
+ * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
1074
+ *
1075
+ * @remarks
1076
+ * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
1077
+ *
1078
+ * @defaultValue "powerlines"
1079
+ */
1080
+ framework?: string;
1081
+ }
1082
+ interface UserConfig$3<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant extends string = any> extends Omit<CommonUserConfig, "build"> {
1083
+ /**
1084
+ * Configuration provided to build processes
1085
+ *
1086
+ * @remarks
1087
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1088
+ */
1089
+ build: Omit<TBuildConfig, "override"> & {
1090
+ /**
1091
+ * The build variant being used by the Powerlines engine.
1092
+ */
1093
+ variant?: TBuildVariant;
1094
+ /**
1095
+ * An optional set of override options to apply to the selected build variant.
1096
+ *
1097
+ * @remarks
1098
+ * 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.
1099
+ */
1100
+ override?: Partial<TBuildResolvedConfig>;
1101
+ };
1102
+ }
1103
+ type WebpackUserConfig = UserConfig$3<WebpackBuildConfig, WebpackResolvedBuildConfig, "webpack">;
1104
+ type RspackUserConfig = UserConfig$3<RspackBuildConfig, RspackResolvedBuildConfig, "rspack">;
1105
+ type RollupUserConfig = UserConfig$3<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
1106
+ type RolldownUserConfig = UserConfig$3<RolldownBuildConfig, RolldownResolvedBuildConfig, "rolldown">;
1107
+ type ViteUserConfig = UserConfig$3<ViteBuildConfig, ViteResolvedBuildConfig, "vite">;
1108
+ type ESBuildUserConfig = UserConfig$3<ESBuildBuildConfig, ESBuildResolvedBuildConfig, "esbuild">;
1109
+ type UnbuildUserConfig = UserConfig$3<UnbuildBuildConfig, UnbuildResolvedBuildConfig, "unbuild">;
1110
+ type TsupUserConfig = UserConfig$3<TsupBuildConfig, TsupResolvedBuildConfig, "tsup">;
1111
+ type TsdownUserConfig = UserConfig$3<TsdownBuildConfig, TsdownResolvedBuildConfig, "tsdown">;
1112
+ type FarmUserConfig = UserConfig$3<FarmBuildConfig, FarmResolvedBuildConfig, "farm">;
1113
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
1114
+ /**
1115
+ * The configuration provided while executing Powerlines commands.
1116
+ */
1117
+ type InlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = Partial<TUserConfig> & {
1118
+ /**
1119
+ * A string identifier for the Powerlines command being executed
1120
+ */
1121
+ command: PowerlinesCommand;
1122
+ };
1123
+ type NewInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
1124
+ /**
1125
+ * A string identifier for the Powerlines command being executed
1126
+ */
1127
+ command: "new";
1128
+ /**
1129
+ * The package name (from the \`package.json\`) for the project that will be used in the \`new\` command to create a new project based on this configuration
1130
+ */
1131
+ packageName?: string;
1132
+ };
1133
+ type CleanInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1134
+ /**
1135
+ * A string identifier for the Powerlines command being executed
1136
+ */
1137
+ command: "clean";
1138
+ };
1139
+ type PrepareInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1140
+ /**
1141
+ * A string identifier for the Powerlines command being executed
1142
+ */
1143
+ command: "prepare";
1144
+ };
1145
+ type BuildInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1146
+ /**
1147
+ * A string identifier for the Powerlines command being executed
1148
+ */
1149
+ command: "build";
1150
+ };
1151
+ type LintInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1152
+ /**
1153
+ * A string identifier for the Powerlines command being executed
1154
+ */
1155
+ command: "lint";
1156
+ };
1157
+ type DocsInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1158
+ /**
1159
+ * A string identifier for the Powerlines command being executed
1160
+ */
1161
+ command: "docs";
1162
+ };
1163
+ type DeployInlineConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = InlineConfig<TUserConfig> & {
1164
+ /**
1165
+ * A string identifier for the Powerlines command being executed
1166
+ */
1167
+ command: "deploy";
1168
+ };
1169
+ //#endregion
1170
+ //#region ../powerlines/src/types/hooks.d.ts
1171
+ type HookListOrders = "preOrdered" | "preEnforced" | "normal" | "postEnforced" | "postOrdered";
1172
+ type UnpluginHookFunctions<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1] = keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1]> = Required<UnpluginOptions>[TUnpluginBuilderVariant$1][TField$1] extends infer THandler | {
1173
+ handler: infer THandler;
1174
+ } ? THandler extends ((this: infer THandlerOriginalContext, ...args: infer THandlerArgs) => infer THandlerReturn) ? (this: THandlerOriginalContext & WithUnpluginBuildContext<TContext>, ...args: THandlerArgs) => THandlerReturn : THandler extends {
1175
+ handler: infer THandlerFunction;
1176
+ } ? THandlerFunction extends ((this: infer THandlerFunctionOriginalContext, ...args: infer THandlerFunctionArgs) => infer THandlerFunctionReturn) ? (this: THandlerFunctionOriginalContext & WithUnpluginBuildContext<TContext>, ...args: THandlerFunctionArgs) => THandlerFunctionReturn : never : never : never;
1177
+ interface PluginHooksListItem<TContext extends PluginContext = PluginContext, TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>> {
1178
+ plugin: Plugin<TContext>;
1179
+ handler: PluginHookFunctions<TContext>[TFields];
1180
+ }
1181
+ type PluginHooksList<TContext extends PluginContext = PluginContext, TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>> = { [TKey in HookListOrders]?: PluginHooksListItem<TContext, TFields>[] | undefined };
1182
+ interface UnpluginHooksListItem<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1] = keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1]> {
1183
+ plugin: Plugin<TContext>;
1184
+ handler: UnpluginHookFunctions<TContext, TUnpluginBuilderVariant$1, TField$1>;
1185
+ }
1186
+ type UnpluginHookList<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof UnpluginOptions[TUnpluginBuilderVariant$1] = keyof UnpluginOptions[TUnpluginBuilderVariant$1]> = { [TKey in HookListOrders]?: UnpluginHooksListItem<TContext, TUnpluginBuilderVariant$1, TField$1>[] | undefined };
1187
+ type UnpluginHookVariantField<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant> = { [TKey in keyof UnpluginOptions[TUnpluginBuilderVariant$1]]?: UnpluginHookList<TContext, TUnpluginBuilderVariant$1, TKey> };
1188
+ type UnpluginHookVariant<TContext extends PluginContext = PluginContext> = { [TKey in UnpluginBuilderVariant]?: UnpluginHookVariantField<TContext, TKey> };
1189
+ type HookFields<TContext extends PluginContext = PluginContext> = PluginHookFields<TContext> | UnpluginBuilderVariant;
1190
+ type HooksList<TContext extends PluginContext = PluginContext> = { [TField in HookFields<TContext>]?: TField extends PluginHookFields<TContext> ? PluginHooksList<TContext, TField> : TField extends UnpluginBuilderVariant ? UnpluginHookVariant<TContext>[TField] : never };
1191
+ type InferHooksListItem<TContext extends PluginContext, TKey$1 extends string> = TKey$1 extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}` ? TUnpluginBuilderVariant extends UnpluginBuilderVariant ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] ? UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TUnpluginField> : never : never : TKey$1 extends keyof PluginHookFunctions<TContext> ? PluginHooksListItem<TContext, TKey$1> : never;
1192
+ type InferHookFunction<TContext extends PluginContext, TKey$1 extends string> = TKey$1 extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}` ? TUnpluginBuilderVariant extends UnpluginBuilderVariant ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] ? UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TUnpluginField> : never : never : TKey$1 extends keyof PluginHookFunctions<TContext> ? PluginHookFunctions<TContext>[TKey$1] : never;
1193
+ type InferHookReturnType<TContext extends PluginContext, TKey$1 extends string> = ReturnType<InferHookFunction<TContext, TKey$1>>;
1194
+ type InferHookParameters<TContext extends PluginContext, TKey$1 extends string> = Parameters<InferHookFunction<TContext, TKey$1>>;
1195
+ //#endregion
1196
+ //#region ../powerlines/src/types/resolved.d.ts
1197
+ interface ResolvedEntryTypeDefinition extends TypeDefinition {
1198
+ /**
1199
+ * The user provided entry point in the source code
1200
+ */
1201
+ input?: TypeDefinition;
1202
+ /**
1203
+ * An optional name to use in the package export during the build process
1204
+ */
1205
+ output?: string;
1206
+ }
1207
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
1208
+ /**
1209
+ * The name of the environment
1210
+ */
1211
+ name: string;
1212
+ /**
1213
+ * Configuration options for the preview server
1214
+ */
1215
+ preview?: ResolvedPreviewOptions;
1216
+ };
1217
+ type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
1218
+ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
1219
+ assets: ResolvedAssetGlob[];
1220
+ }> & Pick<OutputConfig, "storage">;
1221
+ /**
1222
+ * The resolved options for the Powerlines project configuration.
1223
+ */
1224
+ type ResolvedConfig<TUserConfig extends UserConfig$3 = UserConfig$3> = Omit<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
1225
+ /**
1226
+ * The configuration options that were provided inline to the Powerlines CLI.
1227
+ */
1228
+ inlineConfig: InlineConfig<TUserConfig>;
1229
+ /**
1230
+ * The original configuration options that were provided by the user to the Powerlines process.
1231
+ */
1232
+ userConfig: TUserConfig;
1233
+ /**
1234
+ * A string identifier for the Powerlines command being executed.
1235
+ */
1236
+ command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
1237
+ /**
1238
+ * The root directory of the project's source code
1239
+ *
1240
+ * @defaultValue "\{projectRoot\}/src"
1241
+ */
1242
+ sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
1243
+ /**
1244
+ * The root directory of the project.
1245
+ */
1246
+ projectRoot: NonUndefined<TUserConfig["root"]>;
1247
+ /**
1248
+ * The type of project being built.
1249
+ */
1250
+ projectType: NonUndefined<TUserConfig["type"]>;
1251
+ /**
1252
+ * The output configuration options to use for the build process
1253
+ */
1254
+ output: OutputResolvedConfig;
1255
+ /**
1256
+ * Configuration provided to build processes
1257
+ *
1258
+ * @remarks
1259
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuilderVariant | build variant}.
1260
+ */
1261
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
1262
+ /**
1263
+ * The log level to use for the Powerlines processes.
1264
+ *
1265
+ * @defaultValue "info"
1266
+ */
1267
+ logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
1268
+ };
1269
+ type ViteResolvedConfig = ResolvedConfig<ViteUserConfig>;
1270
+ type WebpackResolvedConfig = ResolvedConfig<WebpackUserConfig>;
1271
+ type RspackResolvedConfig = ResolvedConfig<RspackUserConfig>;
1272
+ type ESBuildResolvedConfig = ResolvedConfig<ESBuildUserConfig>;
1273
+ type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
1274
+ type RolldownResolvedConfig = ResolvedConfig<RolldownUserConfig>;
1275
+ type TsupResolvedConfig = ResolvedConfig<TsupUserConfig>;
1276
+ type TsdownResolvedConfig = ResolvedConfig<TsdownUserConfig>;
1277
+ type UnbuildResolvedConfig = ResolvedConfig<UnbuildUserConfig>;
1278
+ type FarmResolvedConfig = ResolvedConfig<FarmUserConfig>;
1279
+ type InferResolvedConfig<TBuildVariant extends BuilderVariant | undefined> = TBuildVariant extends undefined ? ResolvedConfig : TBuildVariant extends "webpack" ? WebpackResolvedConfig : TBuildVariant extends "rspack" ? RspackResolvedConfig : TBuildVariant extends "vite" ? ViteResolvedConfig : TBuildVariant extends "esbuild" ? ESBuildResolvedConfig : TBuildVariant extends "unbuild" ? UnbuildResolvedConfig : TBuildVariant extends "tsup" ? TsupResolvedConfig : TBuildVariant extends "tsdown" ? TsdownResolvedConfig : TBuildVariant extends "rolldown" ? RolldownResolvedConfig : TBuildVariant extends "rollup" ? RollupResolvedConfig : TBuildVariant extends "farm" ? FarmResolvedConfig : ResolvedConfig;
1280
+ //#endregion
1281
+ //#region ../powerlines/src/types/context.d.ts
1282
+ interface MetaInfo {
1283
+ /**
1284
+ * The checksum generated from the resolved options
1285
+ */
1286
+ checksum: string;
1287
+ /**
1288
+ * The build id
1289
+ */
1290
+ buildId: string;
1291
+ /**
1292
+ * The release id
1293
+ */
1294
+ releaseId: string;
1295
+ /**
1296
+ * The build timestamp
1297
+ */
1298
+ timestamp: number;
1299
+ /**
1300
+ * A hash that represents the path to the project root directory
1301
+ */
1302
+ projectRootHash: string;
1303
+ /**
1304
+ * A hash that represents the path to the project root directory
1305
+ */
1306
+ configHash: string;
1307
+ }
1308
+ interface Resolver extends Jiti {
1309
+ plugin: Jiti;
1310
+ }
1311
+ interface TransformResult$1 {
1312
+ code: string;
1313
+ map: SourceMap | null;
1314
+ }
1315
+ interface SelectHooksOptions {
1316
+ order?: "pre" | "post" | "normal";
1317
+ }
1318
+ /**
1319
+ * Options for initializing or updating the context with new configuration values
1320
+ */
1321
+ interface InitContextOptions {
1322
+ /**
1323
+ * If false, the plugin will be loaded after all other plugins.
1324
+ *
1325
+ * @defaultValue true
1326
+ */
1327
+ isHighPriority: boolean;
1328
+ }
1329
+ /**
1330
+ * Options for fetch requests made via the context's {@link Context.fetch} method
1331
+ */
1332
+ interface FetchOptions extends FetchRequestOptions {
1333
+ /**
1334
+ * An indicator specifying that the request should bypass any caching
1335
+ */
1336
+ skipCache?: boolean;
1337
+ }
1338
+ /**
1339
+ * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
1340
+ */
1341
+ interface ParseOptions extends ParserOptions {
1342
+ /**
1343
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1344
+ */
1345
+ allowReturnOutsideFunction?: boolean;
1346
+ }
1347
+ interface EmitOptions extends WriteOptions {
1348
+ /**
1349
+ * The file extension to use when emitting the file
1350
+ */
1351
+ extension?: string;
1352
+ /**
1353
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
1354
+ */
1355
+ emitWithBundler?: boolean;
1356
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
1357
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
1358
+ }
1359
+ /**
1360
+ * Options for emitting entry virtual files
1361
+ */
1362
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
1363
+ /**
1364
+ * The unresolved Powerlines context.
1365
+ *
1366
+ * @remarks
1367
+ * This context is used before the user configuration has been fully resolved after the `config`.
1368
+ */
1369
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1370
+ /**
1371
+ * The Storm workspace configuration
1372
+ */
1373
+ workspaceConfig: WorkspaceConfig;
1374
+ /**
1375
+ * An object containing the options provided to Powerlines
1376
+ */
1377
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1378
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1379
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1380
+ output: TResolvedConfig["output"];
1381
+ };
1382
+ /**
1383
+ * A logging function for the Powerlines engine
1384
+ */
1385
+ log: LogFn;
1386
+ /**
1387
+ * A logging function for fatal messages
1388
+ */
1389
+ fatal: (message: string | UnpluginMessage) => void;
1390
+ /**
1391
+ * A logging function for error messages
1392
+ */
1393
+ error: (message: string | UnpluginMessage) => void;
1394
+ /**
1395
+ * A logging function for warning messages
1396
+ */
1397
+ warn: (message: string | UnpluginMessage) => void;
1398
+ /**
1399
+ * A logging function for informational messages
1400
+ */
1401
+ info: (message: string | UnpluginMessage) => void;
1402
+ /**
1403
+ * A logging function for debug messages
1404
+ */
1405
+ debug: (message: string | UnpluginMessage) => void;
1406
+ /**
1407
+ * A logging function for trace messages
1408
+ */
1409
+ trace: (message: string | UnpluginMessage) => void;
1410
+ /**
1411
+ * The metadata information
1412
+ */
1413
+ meta: MetaInfo;
1414
+ /**
1415
+ * The metadata information currently written to disk
1416
+ */
1417
+ persistedMeta?: MetaInfo;
1418
+ /**
1419
+ * The Powerlines artifacts directory
1420
+ */
1421
+ artifactsPath: string;
1422
+ /**
1423
+ * The path to the Powerlines builtin runtime modules directory
1424
+ */
1425
+ builtinsPath: string;
1426
+ /**
1427
+ * The path to the Powerlines entry modules directory
1428
+ */
1429
+ entryPath: string;
1430
+ /**
1431
+ * The path to the Powerlines TypeScript declaration files directory
1432
+ */
1433
+ dtsPath: string;
1434
+ /**
1435
+ * The path to a directory where the reflection data buffers (used by the build processes) are stored
1436
+ */
1437
+ dataPath: string;
1438
+ /**
1439
+ * The path to a directory where the project cache (used by the build processes) is stored
1440
+ */
1441
+ cachePath: string;
1442
+ /**
1443
+ * The Powerlines environment paths
1444
+ */
1445
+ envPaths: EnvPaths;
1446
+ /**
1447
+ * The file system path to the Powerlines package installation
1448
+ */
1449
+ powerlinesPath: string;
1450
+ /**
1451
+ * The relative path to the Powerlines workspace root directory
1452
+ */
1453
+ relativeToWorkspaceRoot: string;
1454
+ /**
1455
+ * The project's `package.json` file content
1456
+ */
1457
+ packageJson: PackageJson & Record<string, any>;
1458
+ /**
1459
+ * The project's `project.json` file content
1460
+ */
1461
+ projectJson?: Record<string, any>;
1462
+ /**
1463
+ * The dependency installations required by the project
1464
+ */
1465
+ dependencies: Record<string, string | Range>;
1466
+ /**
1467
+ * The development dependency installations required by the project
1468
+ */
1469
+ devDependencies: Record<string, string | Range>;
1470
+ /**
1471
+ * The parsed TypeScript configuration from the `tsconfig.json` file
1472
+ */
1473
+ tsconfig: ParsedTypeScriptConfig;
1474
+ /**
1475
+ * The entry points of the source code
1476
+ */
1477
+ entry: ResolvedEntryTypeDefinition[];
1478
+ /**
1479
+ * The virtual file system manager used during the build process to reference generated runtime files
1480
+ */
1481
+ fs: VirtualFileSystemInterface;
1482
+ /**
1483
+ * The Jiti module resolver
1484
+ */
1485
+ resolver: Resolver;
1486
+ /**
1487
+ * The builtin module id that exist in the Powerlines virtual file system
1488
+ */
1489
+ builtins: string[];
1490
+ /**
1491
+ * The {@link Project} instance used for type reflection and module manipulation
1492
+ *
1493
+ * @see https://ts-morph.com/
1494
+ *
1495
+ * @remarks
1496
+ * This instance is created lazily on first access.
1497
+ */
1498
+ program: Project;
1499
+ /**
1500
+ * A function to perform HTTP fetch requests
1501
+ *
1502
+ * @remarks
1503
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1504
+ *
1505
+ * @example
1506
+ * ```ts
1507
+ * const response = await context.fetch("https://api.example.com/data");
1508
+ * const data = await response.json();
1509
+ * ```
1510
+ *
1511
+ * @see https://github.com/nodejs/undici
1512
+ *
1513
+ * @param input - The URL to fetch.
1514
+ * @param options - The fetch request options.
1515
+ * @returns A promise that resolves to a response returned by the fetch.
1516
+ */
1517
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1518
+ /**
1519
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1520
+ *
1521
+ * @remarks
1522
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1523
+ *
1524
+ * @example
1525
+ * ```ts
1526
+ * const ast = context.parse("const x: number = 42;");
1527
+ * ```
1528
+ *
1529
+ * @see https://rollupjs.org/plugin-development/#this-parse
1530
+ * @see https://github.com/oxc/oxc
1531
+ *
1532
+ * @param code - The source code to parse.
1533
+ * @param options - The options to pass to the parser.
1534
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1535
+ */
1536
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1537
+ /**
1538
+ * A helper function to resolve modules using the Jiti resolver
1539
+ *
1540
+ * @remarks
1541
+ * This function can be used to resolve modules relative to the project root directory.
1542
+ *
1543
+ * @example
1544
+ * ```ts
1545
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1546
+ * ```
1547
+ *
1548
+ * @param id - The module to resolve.
1549
+ * @param importer - An optional path to the importer module.
1550
+ * @param options - Additional resolution options.
1551
+ * @returns A promise that resolves to the resolved module path.
1552
+ */
1553
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<ExternalIdResult | undefined>;
1554
+ /**
1555
+ * A helper function to load modules using the Jiti resolver
1556
+ *
1557
+ * @remarks
1558
+ * This function can be used to load modules relative to the project root directory.
1559
+ *
1560
+ * @example
1561
+ * ```ts
1562
+ * const module = await context.load("some-module", "/path/to/importer");
1563
+ * ```
1564
+ *
1565
+ * @param id - The module to load.
1566
+ * @returns A promise that resolves to the loaded module.
1567
+ */
1568
+ load: (id: string) => Promise<TransformResult$1 | undefined>;
1569
+ /**
1570
+ * The Powerlines builtin virtual files
1571
+ */
1572
+ getBuiltins: () => Promise<VirtualFile[]>;
1573
+ /**
1574
+ * Resolves a file and writes it to the VFS if it does not already exist
1575
+ *
1576
+ * @param code - The source code of the file
1577
+ * @param path - The path to write the file to
1578
+ * @param options - Additional options for writing the file
1579
+ */
1580
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
1581
+ /**
1582
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
1583
+ *
1584
+ * @param code - The source code of the file
1585
+ * @param path - The path to write the file to
1586
+ * @param options - Additional options for writing the file
1587
+ */
1588
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
1589
+ /**
1590
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1591
+ *
1592
+ * @param code - The source code of the builtin file
1593
+ * @param id - The unique identifier of the builtin file
1594
+ * @param options - Additional options for writing the builtin file
1595
+ */
1596
+ emitBuiltin: (code: string, id: string, options?: EmitOptions) => Promise<void>;
1597
+ /**
1598
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
1599
+ *
1600
+ * @param code - The source code of the builtin file
1601
+ * @param id - The unique identifier of the builtin file
1602
+ * @param options - Additional options for writing the builtin file
1603
+ */
1604
+ emitBuiltinSync: (code: string, id: string, options?: EmitOptions) => void;
1605
+ /**
1606
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1607
+ *
1608
+ * @param code - The source code of the entry file
1609
+ * @param path - An optional path to write the entry file to
1610
+ * @param options - Additional options for writing the entry file
1611
+ */
1612
+ emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
1613
+ /**
1614
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
1615
+ *
1616
+ * @param code - The source code of the entry file
1617
+ * @param path - An optional path to write the entry file to
1618
+ * @param options - Additional options for writing the entry file
1619
+ */
1620
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
1621
+ /**
1622
+ * A function to update the context fields using a new user configuration options
1623
+ */
1624
+ withUserConfig: (userConfig: UserConfig$3, options?: InitContextOptions) => Promise<void>;
1625
+ /**
1626
+ * A function to update the context fields using inline configuration options
1627
+ */
1628
+ withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1629
+ /**
1630
+ * Create a new logger instance
1631
+ *
1632
+ * @param name - The name to use for the logger instance
1633
+ * @returns A logger function
1634
+ */
1635
+ createLog: (name: string | null) => LogFn;
1636
+ /**
1637
+ * Extend the current logger instance with a new name
1638
+ *
1639
+ * @param name - The name to use for the extended logger instance
1640
+ * @returns A logger function
1641
+ */
1642
+ extendLog: (name: string) => LogFn;
1643
+ /**
1644
+ * Generates a checksum representing the current context state
1645
+ *
1646
+ * @returns A promise that resolves to a string representing the checksum
1647
+ */
1648
+ generateChecksum: () => Promise<string>;
1649
+ }
1650
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1651
+ /**
1652
+ * The fully resolved Powerlines configuration
1653
+ */
1654
+ config: TResolvedConfig;
1655
+ };
1656
+ interface APIContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
1657
+ /**
1658
+ * The expected plugins options for the Powerlines project.
1659
+ *
1660
+ * @remarks
1661
+ * This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
1662
+ */
1663
+ plugins: Plugin<PluginContext<TResolvedConfig>>[];
1664
+ /**
1665
+ * A function to add a plugin to the context and update the configuration options
1666
+ */
1667
+ addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
1668
+ /**
1669
+ * A table for storing the current context for each configured environment
1670
+ */
1671
+ environments: Record<string, EnvironmentContext<TResolvedConfig>>;
1672
+ /**
1673
+ * Retrieves the context for a specific environment by name
1674
+ *
1675
+ * @throws Will throw an error if the environment does not exist
1676
+ *
1677
+ * @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
1678
+ * @returns A promise that resolves to the environment context.
1679
+ *
1680
+ * @example
1681
+ * ```ts
1682
+ * const devEnv = await apiContext.getEnvironment("development");
1683
+ * const defaultEnv = await apiContext.getEnvironment();
1684
+ * ```
1685
+ */
1686
+ getEnvironment: (name?: string) => Promise<EnvironmentContext<TResolvedConfig>>;
1687
+ /**
1688
+ * Safely retrieves the context for a specific environment by name
1689
+ *
1690
+ * @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
1691
+ * @returns A promise that resolves to the environment context, or undefined if the environment does not exist.
1692
+ *
1693
+ * @example
1694
+ * ```ts
1695
+ * const devEnv = await apiContext.getEnvironmentSafe("development");
1696
+ * const defaultEnv = await apiContext.getEnvironmentSafe();
1697
+ * ```
1698
+ *
1699
+ * @remarks
1700
+ * This method is similar to `getEnvironment`, but it returns `undefined` instead of throwing an error if the specified environment does not exist.
1701
+ * This can be useful in scenarios where the existence of an environment is optional or uncertain.
1702
+ *
1703
+ * ```ts
1704
+ * const testEnv = await apiContext.getEnvironmentSafe("test");
1705
+ * if (testEnv) {
1706
+ * // Environment exists, safe to use it
1707
+ * } else {
1708
+ * // Environment does not exist, handle accordingly
1709
+ * }
1710
+ * ```
1711
+ *
1712
+ * Using this method helps avoid unhandled exceptions in cases where an environment might not be defined.
1713
+ */
1714
+ getEnvironmentSafe: (name?: string) => Promise<EnvironmentContext<TResolvedConfig> | undefined>;
1715
+ /**
1716
+ * A function to copy the context and update the fields for a specific environment
1717
+ *
1718
+ * @param environment - The environment configuration to use.
1719
+ * @returns A new context instance with the updated environment.
1720
+ */
1721
+ in: (environment: EnvironmentResolvedConfig) => Promise<EnvironmentContext<TResolvedConfig>>;
1722
+ /**
1723
+ * A function to merge all configured environments into a single context
1724
+ *
1725
+ * @returns A promise that resolves to the merged environment context.
1726
+ */
1727
+ toEnvironment: () => Promise<EnvironmentContext<TResolvedConfig>>;
1728
+ }
1729
+ interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1730
+ plugin: Plugin<PluginContext<TResolvedConfig>>;
1731
+ context: PluginContext<TResolvedConfig>;
1732
+ }
1733
+ type SelectHookResultItem<TContext extends PluginContext, TKey$1 extends string> = InferHooksListItem<TContext, TKey$1> & {
1734
+ context: TContext;
1735
+ };
1736
+ type SelectHookResult<TContext extends PluginContext, TKey$1 extends string> = SelectHookResultItem<TContext, TKey$1>[];
1737
+ interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
1738
+ /**
1739
+ * The expected plugins options for the Powerlines project.
1740
+ *
1741
+ * @remarks
1742
+ * This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
1743
+ */
1744
+ plugins: EnvironmentContextPlugin<TResolvedConfig>[];
1745
+ /**
1746
+ * A function to add a plugin to the context and update the configuration options
1747
+ */
1748
+ addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
1749
+ /**
1750
+ * The environment specific resolved configuration
1751
+ */
1752
+ environment: EnvironmentResolvedConfig;
1753
+ /**
1754
+ * A table holding references to hook functions registered by plugins
1755
+ */
1756
+ hooks: HooksList<PluginContext<TResolvedConfig>>;
1757
+ /**
1758
+ * Retrieves the hook handlers for a specific hook name
1759
+ */
1760
+ selectHooks: <TKey$1 extends string>(key: TKey$1, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey$1>;
1761
+ }
1762
+ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1763
+ /**
1764
+ * The environment specific resolved configuration
1765
+ */
1766
+ environment: EnvironmentResolvedConfig;
1767
+ /**
1768
+ * An alternative property name for the {@link log} property
1769
+ *
1770
+ * @remarks
1771
+ * This is provided for compatibility with other logging libraries that expect a `logger` property.
1772
+ */
1773
+ logger: LogFn;
1774
+ }
1775
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1776
+ type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
1777
+ //#endregion
1778
+ //#region ../powerlines/src/types/commands.d.ts
1779
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
1780
+ type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
1781
+ //#endregion
1782
+ //#region ../powerlines/src/internal/helpers/hooks.d.ts
1783
+ type CallHookOptions = SelectHooksOptions & (({
1784
+ /**
1785
+ * Whether to call the hooks sequentially or in parallel.
1786
+ *
1787
+ * @defaultValue true
1788
+ */
1789
+ sequential?: true;
1790
+ } & ({
1791
+ /**
1792
+ * How to handle multiple return values from hooks.
1793
+ * - "merge": Merge all non-undefined return values (if they are objects).
1794
+ * - "first": Return the first non-undefined value.
1795
+ *
1796
+ * @remarks
1797
+ * Merging only works if the return values are objects.
1798
+ *
1799
+ * @defaultValue "merge"
1800
+ */
1801
+ result: "first";
1802
+ } | {
1803
+ /**
1804
+ * How to handle multiple return values from hooks.
1805
+ * - "merge": Merge all non-undefined return values (if they are objects).
1806
+ * - "first": Return the first non-undefined value.
1807
+ *
1808
+ * @remarks
1809
+ * Merging only works if the return values are objects.
1810
+ *
1811
+ * @defaultValue "merge"
1812
+ */
1813
+ result?: "merge" | "last";
1814
+ /**
1815
+ * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
1816
+ */
1817
+ asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
1818
+ })) | {
1819
+ /**
1820
+ * Whether to call the hooks sequentially or in parallel.
1821
+ */
1822
+ sequential: false;
1823
+ });
1824
+ //#endregion
1825
+ //#region ../powerlines/src/types/api.d.ts
1826
+ /**
1827
+ * Powerlines API Interface
1828
+ */
1829
+ interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1830
+ /**
1831
+ * The Powerlines shared API context
1832
+ */
1833
+ context: APIContext<TResolvedConfig>;
1834
+ /**
1835
+ * Prepare the Powerlines API
1836
+ *
1837
+ * @remarks
1838
+ * This method will prepare the Powerlines API for use, initializing any necessary resources.
1839
+ *
1840
+ * @param inlineConfig - The inline configuration for the prepare command
1841
+ */
1842
+ prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
1843
+ /**
1844
+ * Create a new Powerlines project
1845
+ *
1846
+ * @remarks
1847
+ * This method will create a new Powerlines project in the current directory.
1848
+ *
1849
+ * @param inlineConfig - The inline configuration for the new command
1850
+ * @returns A promise that resolves when the project has been created
1851
+ */
1852
+ new: (inlineConfig: NewInlineConfig) => Promise<void>;
1853
+ /**
1854
+ * Clean any previously prepared artifacts
1855
+ *
1856
+ * @remarks
1857
+ * This method will remove the previous Powerlines artifacts from the project.
1858
+ *
1859
+ * @param inlineConfig - The inline configuration for the clean command
1860
+ * @returns A promise that resolves when the clean command has completed
1861
+ */
1862
+ clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
1863
+ /**
1864
+ * Lint the project source code
1865
+ *
1866
+ * @param inlineConfig - The inline configuration for the lint command
1867
+ * @returns A promise that resolves when the lint command has completed
1868
+ */
1869
+ lint: (inlineConfig: LintInlineConfig) => Promise<void>;
1870
+ /**
1871
+ * Build the project
1872
+ *
1873
+ * @remarks
1874
+ * This method will build the Powerlines project, generating the necessary artifacts.
1875
+ *
1876
+ * @param inlineConfig - The inline configuration for the build command
1877
+ * @returns A promise that resolves when the build command has completed
1878
+ */
1879
+ build: (inlineConfig: BuildInlineConfig) => Promise<void>;
1880
+ /**
1881
+ * Prepare the documentation for the project
1882
+ *
1883
+ * @param inlineConfig - The inline configuration for the docs command
1884
+ * @returns A promise that resolves when the documentation generation has completed
1885
+ */
1886
+ docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
1887
+ /**
1888
+ * Deploy the project source code
1889
+ *
1890
+ * @remarks
1891
+ * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
1892
+ *
1893
+ * @param inlineConfig - The inline configuration for the deploy command
1894
+ */
1895
+ deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
1896
+ /**
1897
+ * Finalization process
1898
+ *
1899
+ * @remarks
1900
+ * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
1901
+ *
1902
+ * @returns A promise that resolves when the finalization process has completed
1903
+ */
1904
+ finalize: () => Promise<void>;
1905
+ /**
1906
+ * Invokes the configured plugin hooks
1907
+ *
1908
+ * @remarks
1909
+ * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
1910
+ *
1911
+ * @param hook - The hook to call
1912
+ * @param options - The options to provide to the hook
1913
+ * @param args - The arguments to pass to the hook
1914
+ * @returns The result of the hook call
1915
+ */
1916
+ callHook: <TKey$1 extends string>(hook: TKey$1, options: CallHookOptions & {
1917
+ environment?: string | EnvironmentContext<TResolvedConfig>;
1918
+ }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey$1>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey$1> | undefined>;
1919
+ }
1920
+ //#endregion
1921
+ //#region ../powerlines/src/types/unplugin.d.ts
1922
+ interface UnpluginOptions$1<TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant> extends UnpluginOptions {
1923
+ /**
1924
+ * An API object that can be used for inter-plugin communication.
1925
+ *
1926
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
1927
+ */
1928
+ api: API<InferResolvedConfig<TUnpluginBuilderVariant$1>>;
1929
+ }
1930
+ type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant$1 extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant$1> = InferUnpluginVariant<TBuilderVariant$1>> = { [TKey in keyof Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] extends infer THandler | {
1931
+ handler: infer THandler;
1932
+ } ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TUnpluginVariant>>[TUnpluginVariant][TKey] };
1933
+ //#endregion
1934
+ //#region ../powerlines/src/types/plugin.d.ts
1935
+ interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
1936
+ /**
1937
+ * The order in which the plugin should be applied.
1938
+ */
1939
+ order?: "pre" | "post" | null | undefined;
1940
+ /**
1941
+ * A filter to determine when the hook should be called.
1942
+ */
1943
+ filter?: Pick<HookFilter, TFilter>;
1944
+ /**
1945
+ * The hook function to be called.
1946
+ */
1947
+ handler: THookFunction;
1948
+ }
1949
+ type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
1950
+ /**
1951
+ * A result returned by the plugin from the `types` hook that describes the declaration types output file.
1952
+ */
1953
+ interface TypesResult {
1954
+ directives?: string[];
1955
+ code: string;
1956
+ }
1957
+ type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & {
1958
+ /**
1959
+ * A function that returns configuration options to be merged with the build context's options.
1960
+ *
1961
+ * @remarks
1962
+ * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
1963
+ *
1964
+ * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
1965
+ *
1966
+ * @see https://vitejs.dev/guide/api-plugin#config
1967
+ *
1968
+ * @param this - The build context.
1969
+ * @param config - The partial configuration object to be modified.
1970
+ * @returns A promise that resolves to a partial configuration object.
1971
+ */
1972
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>;
1973
+ /**
1974
+ * 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.
1975
+ *
1976
+ * @remarks
1977
+ * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
1978
+ *
1979
+ * @see https://vitejs.dev/guide/api-plugin#configenvironment
1980
+ *
1981
+ * @param this - The build context.
1982
+ * @param name - The name of the environment being configured.
1983
+ * @param environment - The Vite-like environment object containing information about the current build environment.
1984
+ * @returns A promise that resolves when the hook is complete.
1985
+ */
1986
+ configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
1987
+ /**
1988
+ * A hook that is called when the plugin is resolved.
1989
+ *
1990
+ * @see https://vitejs.dev/guide/api-plugin#configresolved
1991
+ *
1992
+ * @param this - The build context.
1993
+ * @returns A promise that resolves when the hook is complete.
1994
+ */
1995
+ configResolved: (this: TContext) => MaybePromise<void>;
1996
+ /**
1997
+ * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
1998
+ *
1999
+ * @param this - The build context.
2000
+ * @param code - The source code to generate types for.
2001
+ * @returns A promise that resolves when the hook is complete.
2002
+ */
2003
+ types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
2004
+ /**
2005
+ * A hook that is called at the start of the build process.
2006
+ *
2007
+ * @param this - The build context and unplugin build context.
2008
+ * @returns A promise that resolves when the hook is complete.
2009
+ */
2010
+ buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
2011
+ /**
2012
+ * A hook that is called at the end of the build process.
2013
+ *
2014
+ * @param this - The build context and unplugin build context.
2015
+ * @returns A promise that resolves when the hook is complete.
2016
+ */
2017
+ buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
2018
+ /**
2019
+ * A hook that is called to transform the source code.
2020
+ *
2021
+ * @param this - The build context, unplugin build context, and unplugin context.
2022
+ * @param code - The source code to transform.
2023
+ * @param id - The identifier of the source code.
2024
+ * @returns A promise that resolves when the hook is complete.
2025
+ */
2026
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
2027
+ /**
2028
+ * A hook that is called to load the source code.
2029
+ *
2030
+ * @param this - The build context, unplugin build context, and unplugin context.
2031
+ * @param id - The identifier of the source code.
2032
+ * @returns A promise that resolves when the hook is complete.
2033
+ */
2034
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
2035
+ /**
2036
+ * A hook that is called to resolve the identifier of the source code.
2037
+ *
2038
+ * @param this - The build context, unplugin build context, and unplugin context.
2039
+ * @param id - The identifier of the source code.
2040
+ * @param importer - The importer of the source code.
2041
+ * @param options - The options for resolving the identifier.
2042
+ * @returns A promise that resolves when the hook is complete.
2043
+ */
2044
+ resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
2045
+ isEntry: boolean;
2046
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>;
2047
+ /**
2048
+ * A hook that is called to write the bundle to disk.
2049
+ *
2050
+ * @param this - The build context.
2051
+ * @returns A promise that resolves when the hook is complete.
2052
+ */
2053
+ writeBundle: (this: TContext) => MaybePromise<void>;
2054
+ };
2055
+ type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
2056
+ transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
2057
+ load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
2058
+ resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
2059
+ };
2060
+ type DeepPartial<T> = { [K in keyof T]?: DeepPartial<T[K]> };
2061
+ type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
2062
+ /**
2063
+ * The name of the plugin, for use in deduplication, error messages and logs.
2064
+ */
2065
+ name: string;
2066
+ /**
2067
+ * An API object that can be used for inter-plugin communication.
2068
+ *
2069
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
2070
+ */
2071
+ api?: Record<string, any>;
2072
+ /**
2073
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
2074
+ *
2075
+ * @remarks
2076
+ * The Plugin invocation order is as follows:
2077
+ * - `enforce: 'pre'` plugins
2078
+ * - `order: 'pre'` plugin hooks
2079
+ * - any other plugins (normal)
2080
+ * - `order: 'post'` plugin hooks
2081
+ * - `enforce: 'post'` plugins
2082
+ *
2083
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
2084
+ * @see https://rollupjs.org/plugin-development/#build-hooks
2085
+ * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
2086
+ * @see https://esbuild.github.io/plugins/#concepts
2087
+ */
2088
+ enforce?: "pre" | "post";
2089
+ /**
2090
+ * A function to determine if two plugins are the same and can be de-duplicated.
2091
+ *
2092
+ * @remarks
2093
+ * If this is not provided, plugins are de-duplicated by comparing their names.
2094
+ *
2095
+ * @param other - The other plugin to compare against.
2096
+ * @returns `true` if the two plugins are the same, `false` otherwise.
2097
+ */
2098
+ dedupe?: false | ((other: Plugin<any>) => boolean);
2099
+ /**
2100
+ * A list of pre-requisite plugins that must be loaded before this plugin can be used.
2101
+ */
2102
+ /**
2103
+ * Define environments where this plugin should be active. By default, the plugin is active in all environments.
2104
+ *
2105
+ * @param environment - The environment to check.
2106
+ * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
2107
+ */
2108
+ applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
2109
+ /**
2110
+ * A function that returns configuration options to be merged with the build context's options.
2111
+ *
2112
+ * @remarks
2113
+ * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
2114
+ *
2115
+ * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
2116
+ *
2117
+ * @see https://vitejs.dev/guide/api-plugin#config
2118
+ *
2119
+ * @param this - The build context.
2120
+ * @param config - The partial configuration object to be modified.
2121
+ * @returns A promise that resolves to a partial configuration object.
2122
+ */
2123
+ config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial<TContext["config"]> & Record<string, any>>> | (DeepPartial<TContext["config"]> & Record<string, any>);
2124
+ } & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
2125
+ type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
2126
+ import * as import___deepkit_type_compiler_config from "@deepkit/type-compiler/config";
2127
+ //#endregion
2128
+ //#region ../plugin-tsc/src/types/plugin.d.ts
2129
+ type TypeScriptCompilerPluginOptions = Partial<Omit<ts.TranspileOptions, "fileName">> & {
2130
+ /**
2131
+ * Whether to perform type checking during the `lint` task.
2132
+ *
2133
+ * @defaultValue false
2134
+ */
2135
+ typeCheck?: boolean;
2136
+ };
2137
+ interface TypeScriptCompilerPluginUserConfig extends UserConfig$3 {
2138
+ transform: {
2139
+ /**
2140
+ * TypeScript Compiler transformation options
2141
+ */
2142
+ tsc: Partial<Omit<TypeScriptCompilerPluginOptions, "typeCheck">> & Required<Pick<TypeScriptCompilerPluginOptions, "typeCheck">>;
2143
+ };
2144
+ }
2145
+ interface TypeScriptCompilerPluginResolvedConfig extends ResolvedConfig {
2146
+ transform: {
2147
+ /**
2148
+ * Resolved TypeScript Compiler transformation options
2149
+ */
2150
+ tsc: Partial<Omit<TypeScriptCompilerPluginOptions, "typeCheck">> & Required<Pick<TypeScriptCompilerPluginOptions, "typeCheck">>;
2151
+ };
2152
+ }
2153
+ type TypeScriptCompilerPluginContext<TResolvedConfig extends TypeScriptCompilerPluginResolvedConfig = TypeScriptCompilerPluginResolvedConfig> = PluginContext<TResolvedConfig>;
2154
+ //#endregion
2155
+ //#region src/types/plugin.d.ts
2156
+ type DeepkitPluginOptions = Partial<config_d_exports.ReflectionConfig> & TypeScriptCompilerPluginOptions;
2157
+ type DeepkitPluginUserConfig = TypeScriptCompilerPluginUserConfig & {
2158
+ transform: {
2159
+ /**
2160
+ * Deepkit transformation options
2161
+ */
2162
+ deepkit: DeepkitPluginOptions;
2163
+ };
2164
+ };
2165
+ type DeepkitPluginResolvedConfig = TypeScriptCompilerPluginResolvedConfig & {
2166
+ transform: {
2167
+ /**
2168
+ * Resolved deepkit transformation options
2169
+ */
2170
+ deepkit: Required<DeepkitPluginOptions>;
2171
+ };
2172
+ };
2173
+ type DeepkitPluginContext<TResolvedConfig extends DeepkitPluginResolvedConfig = DeepkitPluginResolvedConfig> = TypeScriptCompilerPluginContext<TResolvedConfig>;
2174
+ declare type __ΩDeepkitPluginOptions = any[];
2175
+ declare type __ΩDeepkitPluginUserConfig = any[];
2176
+ declare type __ΩDeepkitPluginResolvedConfig = any[];
2177
+ declare type __ΩDeepkitPluginContext = any[];
2178
+ //#endregion
2179
+ export { __ΩDeepkitPluginContext as a, __ΩDeepkitPluginUserConfig as c, DeepkitPluginUserConfig as i, Plugin as l, DeepkitPluginOptions as n, __ΩDeepkitPluginOptions as o, DeepkitPluginResolvedConfig as r, __ΩDeepkitPluginResolvedConfig as s, DeepkitPluginContext as t };