@powerlines/plugin-rollup 0.7.56 → 0.7.58

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.
Files changed (59) hide show
  1. package/README.md +8 -2
  2. package/dist/helpers/index.cjs +1 -1
  3. package/dist/helpers/index.d.cts +4 -25
  4. package/dist/helpers/index.d.mts +4 -0
  5. package/dist/helpers/index.mjs +1 -0
  6. package/dist/helpers/unplugin.cjs +1 -7
  7. package/dist/helpers/unplugin.d.cts +3 -28
  8. package/dist/helpers/unplugin.d.mts +3 -0
  9. package/dist/helpers/unplugin.mjs +1 -0
  10. package/dist/helpers-CRPRhztf.mjs +1 -0
  11. package/dist/index-9iG2qHLe.d.mts +1 -0
  12. package/dist/index-D4ELpJXS.d.cts +1 -0
  13. package/dist/index-D6CnpA_r.d.cts +1 -0
  14. package/dist/index-DL0uimUT.d.mts +1 -0
  15. package/dist/index.cjs +1 -7
  16. package/dist/index.d.cts +9 -28
  17. package/dist/index.d.cts.map +1 -0
  18. package/dist/index.d.mts +14 -0
  19. package/dist/index.d.mts.map +1 -0
  20. package/dist/index.mjs +2 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/plugin-BjiGfRHE.mjs +1 -0
  23. package/dist/plugin-bQr2Yzym.d.cts +1656 -0
  24. package/dist/plugin-bQr2Yzym.d.cts.map +1 -0
  25. package/dist/plugin-pBKbb5K9.cjs +0 -0
  26. package/dist/plugin-ziWFtAvF.d.mts +1659 -0
  27. package/dist/plugin-ziWFtAvF.d.mts.map +1 -0
  28. package/dist/types/index.cjs +1 -1
  29. package/dist/types/index.d.cts +3 -23
  30. package/dist/types/index.d.mts +3 -0
  31. package/dist/types/index.mjs +1 -0
  32. package/dist/types/plugin.cjs +1 -1
  33. package/dist/types/plugin.d.cts +2 -23
  34. package/dist/types/plugin.d.mts +2 -0
  35. package/dist/types/plugin.mjs +1 -0
  36. package/dist/types-n6NgD0QK.mjs +1 -0
  37. package/dist/types-o3zWarRp.cjs +0 -0
  38. package/dist/unplugin-Bx3t7ZoA.d.cts +8 -0
  39. package/dist/unplugin-Bx3t7ZoA.d.cts.map +1 -0
  40. package/dist/unplugin-CLsmVZMo.cjs +44 -0
  41. package/dist/unplugin-Rgj8lLxv.mjs +7 -0
  42. package/dist/unplugin-Rgj8lLxv.mjs.map +1 -0
  43. package/dist/unplugin-jgdfbAHn.d.mts +8 -0
  44. package/dist/unplugin-jgdfbAHn.d.mts.map +1 -0
  45. package/package.json +52 -34
  46. package/dist/chunk-FBBMZ4NC.cjs +0 -7
  47. package/dist/chunk-UCUR73HG.js +0 -7
  48. package/dist/helpers/index.d.ts +0 -25
  49. package/dist/helpers/index.js +0 -1
  50. package/dist/helpers/unplugin.d.ts +0 -28
  51. package/dist/helpers/unplugin.js +0 -7
  52. package/dist/index-DwNsvBx_.d.cts +0 -1567
  53. package/dist/index-DwNsvBx_.d.ts +0 -1567
  54. package/dist/index.d.ts +0 -33
  55. package/dist/index.js +0 -7
  56. package/dist/types/index.d.ts +0 -23
  57. package/dist/types/index.js +0 -1
  58. package/dist/types/plugin.d.ts +0 -23
  59. /package/dist/{types/plugin.js → helpers-LF26RHol.cjs} +0 -0
@@ -0,0 +1,1659 @@
1
+ import { OutputOptions, RollupOptions } from "rollup";
2
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
3
+ import { ExternalIdResult, HookFilter, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage, UnpluginOptions } from "unplugin";
4
+ import { transformAsync } from "@babel/core";
5
+ import { ResolveOptions } from "@stryke/fs/resolve";
6
+ import "@babel/helper-plugin-utils";
7
+ import ts from "typescript";
8
+ import { Project } from "ts-morph";
9
+ import "c12";
10
+ import { EnvPaths } from "@stryke/env/get-env-paths";
11
+ import { FetchRequestOptions } from "@stryke/http/fetch";
12
+ import { ParseResult, ParserOptions } from "oxc-parser";
13
+ import { RequestInfo, Response } from "undici";
14
+ import { Jiti } from "jiti";
15
+ import { SourceMap } from "magic-string";
16
+ import { PreviewOptions, ResolvedPreviewOptions } from "vite";
17
+ import { FunctionLike, MaybePromise, NonUndefined } from "@stryke/types/base";
18
+ import { PackageJson } from "@stryke/types/package-json";
19
+ import { Range } from "semver";
20
+ import { Format } from "@storm-software/build-tools/types";
21
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
22
+ import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
23
+ import { AssetGlob } from "@stryke/types/file";
24
+ import { ArrayValues } from "@stryke/types/array";
25
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
26
+
27
+ //#region ../powerlines/src/types/build.d.ts
28
+ type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
29
+ interface BuildConfig {
30
+ /**
31
+ * The platform to build the project for
32
+ *
33
+ * @defaultValue "neutral"
34
+ */
35
+ platform?: "node" | "browser" | "neutral";
36
+ /**
37
+ * Array of strings indicating the polyfills to include for the build.
38
+ *
39
+ * @remarks
40
+ * 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).
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * {
45
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
46
+ * }
47
+ * ```
48
+ */
49
+ polyfill?: string[];
50
+ /**
51
+ * 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.
52
+ *
53
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
54
+ */
55
+ mainFields?: string[];
56
+ /**
57
+ * Array of strings indicating what conditions should be used for module resolution.
58
+ */
59
+ conditions?: string[];
60
+ /**
61
+ * Array of strings indicating what file extensions should be used for module resolution.
62
+ *
63
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
64
+ */
65
+ extensions?: string[];
66
+ /**
67
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
68
+ *
69
+ * @remarks
70
+ * 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.
71
+ */
72
+ dedupe?: string[];
73
+ /**
74
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
75
+ */
76
+ builtins?: (string | RegExp)[];
77
+ /**
78
+ * Define global variable replacements.
79
+ *
80
+ * @remarks
81
+ * 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.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * {
86
+ * define: {
87
+ * __VERSION__: '"1.0.0"',
88
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
89
+ * }
90
+ * }
91
+ * ```
92
+ *
93
+ * @see https://esbuild.github.io/api/#define
94
+ * @see https://vitejs.dev/config/build-options.html#define
95
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
96
+ */
97
+ define?: Record<string, any>;
98
+ /**
99
+ * Global variables that will have import statements injected where necessary
100
+ *
101
+ * @remarks
102
+ * 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.
103
+ *
104
+ * @example
105
+ * ```ts
106
+ * {
107
+ * inject: {
108
+ * process: 'process/browser',
109
+ * Buffer: ['buffer', 'Buffer'],
110
+ * }
111
+ * }
112
+ * ```
113
+ *
114
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
115
+ */
116
+ inject?: Record<string, string | string[]>;
117
+ /**
118
+ * The alias mappings to use for module resolution during the build process.
119
+ *
120
+ * @remarks
121
+ * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * {
126
+ * alias: {
127
+ * "@utils": "./src/utils",
128
+ * "@components": "./src/components"
129
+ * }
130
+ * }
131
+ * ```
132
+ *
133
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
134
+ */
135
+ alias?: Record<string, string> | Array<{
136
+ find: string | RegExp;
137
+ replacement: string;
138
+ }>;
139
+ /**
140
+ * A list of modules that should not be bundled, even if they are external dependencies.
141
+ *
142
+ * @remarks
143
+ * 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.
144
+ */
145
+ external?: (string | RegExp)[];
146
+ /**
147
+ * A list of modules that should always be bundled, even if they are external dependencies.
148
+ */
149
+ noExternal?: (string | RegExp)[];
150
+ /**
151
+ * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
152
+ */
153
+ skipNodeModulesBundle?: boolean;
154
+ /**
155
+ * An optional set of override options to apply to the selected build variant.
156
+ *
157
+ * @remarks
158
+ * 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.
159
+ */
160
+ override?: Record<string, any>;
161
+ }
162
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
163
+ type RollupBuildOutputConfig = Omit<OutputOptions, "dir" | "format">;
164
+ type RollupBuildConfig = Omit<RollupOptions, "entry" | "external" | "input" | "output" | "logLevel"> & {
165
+ output: RollupBuildOutputConfig | RollupBuildOutputConfig[];
166
+ } & BuildConfig;
167
+ type RollupResolvedBuildConfig = RollupOptions & BuildResolvedConfig;
168
+ //#endregion
169
+ //#region ../powerlines/src/types/fs.d.ts
170
+ declare enum StoragePreset {
171
+ VIRTUAL = "virtual",
172
+ FS = "fs",
173
+ }
174
+ /**
175
+ * Interface defining the methods and properties for a storage adapter.
176
+ */
177
+ interface StorageAdapter {
178
+ /**
179
+ * A name identifying the storage adapter type.
180
+ */
181
+ name: string;
182
+ /**
183
+ * Checks if a key exists in the storage.
184
+ *
185
+ * @param key - The key to check for existence.
186
+ * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
187
+ */
188
+ exists: (key: string) => Promise<boolean>;
189
+ /**
190
+ * Synchronously checks if a key exists in the storage.
191
+ *
192
+ * @param key - The key to check for existence.
193
+ * @returns Returns `true` if the key exists, otherwise `false`.
194
+ */
195
+ existsSync: (key: string) => boolean;
196
+ /**
197
+ * Read a value associated with a key from the storage.
198
+ *
199
+ * @param key - The key to read the value for.
200
+ * @returns A promise that resolves to the value if found, otherwise `null`.
201
+ */
202
+ get: (key: string) => Promise<string | null>;
203
+ /**
204
+ * Synchronously reads the value associated with a key from the storage.
205
+ *
206
+ * @param key - The key to read the value for.
207
+ * @returns The value if found, otherwise `null`.
208
+ */
209
+ getSync: (key: string) => string | null;
210
+ /**
211
+ * Writes a value to the storage for the given key.
212
+ *
213
+ * @param key - The key to associate the value with.
214
+ * @param value - The value to store.
215
+ */
216
+ set: (key: string, value: string) => Promise<void>;
217
+ /**
218
+ * Synchronously writes a value to the storage for the given key.
219
+ *
220
+ * @param key - The key to associate the value with.
221
+ * @param value - The value to store.
222
+ */
223
+ setSync: (key: string, value: string) => void;
224
+ /**
225
+ * Removes a value from the storage.
226
+ *
227
+ * @param key - The key whose value should be removed.
228
+ */
229
+ remove: (key: string) => Promise<void>;
230
+ /**
231
+ * Synchronously removes a value from the storage.
232
+ *
233
+ * @param key - The key whose value should be removed.
234
+ */
235
+ removeSync: (key: string) => void;
236
+ /**
237
+ * Creates a directory at the specified path.
238
+ *
239
+ * @param dirPath - The path of the directory to create.
240
+ */
241
+ mkdir: (dirPath: string) => Promise<void>;
242
+ /**
243
+ * Synchronously creates a directory at the specified path.
244
+ *
245
+ * @param dirPath - The path of the directory to create.
246
+ */
247
+ mkdirSync: (dirPath: string) => void;
248
+ /**
249
+ * Remove all entries from the storage that match the provided base path.
250
+ *
251
+ * @param base - The base path or prefix to clear entries from.
252
+ */
253
+ clear: (base?: string) => Promise<void>;
254
+ /**
255
+ * Synchronously remove all entries from the storage that match the provided base path.
256
+ *
257
+ * @param base - The base path or prefix to clear entries from.
258
+ */
259
+ clearSync: (base?: string) => void;
260
+ /**
261
+ * Lists all keys under the provided base path.
262
+ *
263
+ * @param base - The base path or prefix to list keys from.
264
+ * @returns A promise resolving to the list of keys.
265
+ */
266
+ list: (base?: string) => Promise<string[]>;
267
+ /**
268
+ * Synchronously lists all keys under the provided base path.
269
+ *
270
+ * @param base - The base path or prefix to list keys from.
271
+ * @returns The list of keys.
272
+ */
273
+ listSync: (base?: string) => string[];
274
+ /**
275
+ * Checks if the given key is a directory.
276
+ *
277
+ * @param key - The key to check.
278
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
279
+ */
280
+ isDirectory: (key: string) => Promise<boolean>;
281
+ /**
282
+ * Synchronously checks if the given key is a directory.
283
+ *
284
+ * @param key - The key to check.
285
+ * @returns `true` if the key is a directory, otherwise `false`.
286
+ */
287
+ isDirectorySync: (key: string) => boolean;
288
+ /**
289
+ * Checks if the given key is a file.
290
+ *
291
+ * @param key - The key to check.
292
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
293
+ */
294
+ isFile: (key: string) => Promise<boolean>;
295
+ /**
296
+ * Synchronously checks if the given key is a file.
297
+ *
298
+ * @param key - The key to check.
299
+ * @returns `true` if the key is a file, otherwise `false`.
300
+ */
301
+ isFileSync: (key: string) => boolean;
302
+ /**
303
+ * Releases any resources held by the storage adapter.
304
+ */
305
+ dispose: () => MaybePromise<void>;
306
+ }
307
+ /**
308
+ * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
309
+ */
310
+ type StoragePort = Record<string, StorageAdapter>;
311
+ interface VirtualFileMetadata {
312
+ /**
313
+ * The identifier for the file data.
314
+ */
315
+ id: string;
316
+ /**
317
+ * The timestamp of the virtual file.
318
+ */
319
+ timestamp: number;
320
+ /**
321
+ * The type of the file.
322
+ *
323
+ * @remarks
324
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
325
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
326
+ * - `entry`: Indicates that the file is an entry point for execution.
327
+ * - `normal`: Indicates that the file is a standard file without any special role.
328
+ */
329
+ type: string;
330
+ /**
331
+ * Additional metadata associated with the file.
332
+ */
333
+ properties: Record<string, string>;
334
+ }
335
+ interface VirtualFileData {
336
+ /**
337
+ * The identifier for the file data.
338
+ */
339
+ id?: string;
340
+ /**
341
+ * The contents of the virtual file.
342
+ */
343
+ code: string;
344
+ /**
345
+ * The type of the file.
346
+ *
347
+ * @remarks
348
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
349
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
350
+ * - `entry`: Indicates that the file is an entry point for execution.
351
+ * - `normal`: Indicates that the file is a standard file without any special role.
352
+ */
353
+ type?: string;
354
+ /**
355
+ * Additional metadata associated with the file.
356
+ */
357
+ properties?: Record<string, string>;
358
+ }
359
+ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
360
+ /**
361
+ * An additional name for the file.
362
+ */
363
+ path: string;
364
+ /**
365
+ * The timestamp of the virtual file.
366
+ */
367
+ timestamp: number;
368
+ }
369
+ interface WriteOptions {
370
+ /**
371
+ * Should the file skip formatting before being written?
372
+ *
373
+ * @defaultValue false
374
+ */
375
+ skipFormat?: boolean;
376
+ /**
377
+ * Additional metadata for the file.
378
+ */
379
+ meta?: VirtualFileMetadata;
380
+ }
381
+ interface ResolveOptions$1 extends ResolveOptions {
382
+ /**
383
+ * If true, the module is being resolved as an entry point.
384
+ */
385
+ isEntry?: boolean;
386
+ /**
387
+ * If true, the resolver will skip using the cache when resolving modules.
388
+ */
389
+ skipCache?: boolean;
390
+ /**
391
+ * An array of external modules or patterns to exclude from resolution.
392
+ */
393
+ external?: (string | RegExp)[];
394
+ /**
395
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
396
+ */
397
+ noExternal?: (string | RegExp)[];
398
+ /**
399
+ * An array of patterns to match when resolving modules.
400
+ */
401
+ skipNodeModulesBundle?: boolean;
402
+ }
403
+ interface VirtualFileSystemInterface {
404
+ /**
405
+ * The underlying file metadata.
406
+ */
407
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
408
+ /**
409
+ * A map of file paths to their module ids.
410
+ */
411
+ ids: Readonly<Record<string, string>>;
412
+ /**
413
+ * A map of module ids to their file paths.
414
+ */
415
+ paths: Readonly<Record<string, string>>;
416
+ /**
417
+ * Checks if a file exists in the virtual file system (VFS).
418
+ *
419
+ * @param path - The path or id of the file.
420
+ * @returns `true` if the file exists, otherwise `false`.
421
+ */
422
+ exists: (path: string) => Promise<boolean>;
423
+ /**
424
+ * Synchronously Checks if a file exists in the virtual file system (VFS).
425
+ *
426
+ * @param path - The path or id of the file.
427
+ * @returns `true` if the file exists, otherwise `false`.
428
+ */
429
+ existsSync: (path: string) => boolean;
430
+ /**
431
+ * Checks if a file is virtual in the virtual file system (VFS).
432
+ *
433
+ * @param path - The path or id of the file.
434
+ * @returns `true` if the file is virtual, otherwise `false`.
435
+ */
436
+ isVirtual: (path: string) => boolean;
437
+ /**
438
+ * Checks if the given key is a directory.
439
+ *
440
+ * @param key - The key to check.
441
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
442
+ */
443
+ isDirectory: (key: string) => Promise<boolean>;
444
+ /**
445
+ * Synchronously checks if the given key is a directory.
446
+ *
447
+ * @param key - The key to check.
448
+ * @returns `true` if the key is a directory, otherwise `false`.
449
+ */
450
+ isDirectorySync: (key: string) => boolean;
451
+ /**
452
+ * Checks if the given key is a file.
453
+ *
454
+ * @param key - The key to check.
455
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
456
+ */
457
+ isFile: (key: string) => Promise<boolean>;
458
+ /**
459
+ * Synchronously checks if the given key is a file.
460
+ *
461
+ * @param key - The key to check.
462
+ * @returns `true` if the key is a file, otherwise `false`.
463
+ */
464
+ isFileSync: (key: string) => boolean;
465
+ /**
466
+ * Gets the metadata of a file in the virtual file system (VFS).
467
+ *
468
+ * @param path - The path or id of the file.
469
+ * @returns The metadata of the file if it exists, otherwise undefined.
470
+ */
471
+ getMetadata: (path: string) => VirtualFileMetadata | undefined;
472
+ /**
473
+ * Lists files in a given path.
474
+ *
475
+ * @param path - The path to list files from.
476
+ * @returns An array of file names in the specified path.
477
+ */
478
+ listSync: (path: string) => string[];
479
+ /**
480
+ * Lists files in a given path.
481
+ *
482
+ * @param path - The path to list files from.
483
+ * @returns An array of file names in the specified path.
484
+ */
485
+ list: (path: string) => Promise<string[]>;
486
+ /**
487
+ * Removes a file or symbolic link in the virtual file system (VFS).
488
+ *
489
+ * @param path - The path to the file to remove.
490
+ * @returns A promise that resolves when the file is removed.
491
+ */
492
+ removeSync: (path: string) => void;
493
+ /**
494
+ * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
495
+ *
496
+ * @param path - The path to the file to remove.
497
+ * @returns A promise that resolves when the file is removed.
498
+ */
499
+ remove: (path: string) => Promise<void>;
500
+ /**
501
+ * Reads a file from the virtual file system (VFS).
502
+ *
503
+ * @param path - The path or id of the file.
504
+ * @returns The contents of the file if it exists, otherwise undefined.
505
+ */
506
+ read: (path: string) => Promise<string | undefined>;
507
+ /**
508
+ * Reads a file from the virtual file system (VFS).
509
+ *
510
+ * @param path - The path or id of the file.
511
+ */
512
+ readSync: (path: string) => string | undefined;
513
+ /**
514
+ * Writes a file to the virtual file system (VFS).
515
+ *
516
+ * @param path - The path to the file.
517
+ * @param data - The contents of the file.
518
+ * @param options - Options for writing the file.
519
+ * @returns A promise that resolves when the file is written.
520
+ */
521
+ write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
522
+ /**
523
+ * Writes a file to the virtual file system (VFS).
524
+ *
525
+ * @param path - The path to the file.
526
+ * @param data - The contents of the file.
527
+ * @param options - Options for writing the file.
528
+ */
529
+ writeSync: (path: string, data: string, options?: WriteOptions) => void;
530
+ /**
531
+ * Creates a directory at the specified path.
532
+ *
533
+ * @param dirPath - The path of the directory to create.
534
+ */
535
+ mkdir: (dirPath: string) => Promise<void>;
536
+ /**
537
+ * Synchronously creates a directory at the specified path.
538
+ *
539
+ * @param dirPath - The path of the directory to create.
540
+ */
541
+ mkdirSync: (dirPath: string) => void;
542
+ /**
543
+ * Moves a file from one path to another in the virtual file system (VFS).
544
+ *
545
+ * @param srcPath - The source path to move
546
+ * @param destPath - The destination path to move to
547
+ */
548
+ move: (srcPath: string, destPath: string) => Promise<void>;
549
+ /**
550
+ * Synchronously moves a file from one path to another in the virtual file system (VFS).
551
+ *
552
+ * @param srcPath - The source path to move
553
+ * @param destPath - The destination path to move to
554
+ */
555
+ moveSync: (srcPath: string, destPath: string) => void;
556
+ /**
557
+ * Copies a file from one path to another in the virtual file system (VFS).
558
+ *
559
+ * @param srcPath - The source path to copy
560
+ * @param destPath - The destination path to copy to
561
+ */
562
+ copy: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => Promise<void>;
563
+ /**
564
+ * Synchronously copies a file from one path to another in the virtual file system (VFS).
565
+ *
566
+ * @param srcPath - The source path to copy
567
+ * @param destPath - The destination path to copy to
568
+ */
569
+ copySync: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => void;
570
+ /**
571
+ * Glob files in the virtual file system (VFS) based on the provided pattern(s).
572
+ *
573
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
574
+ * @returns An array of file paths matching the provided pattern(s)
575
+ */
576
+ glob: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => Promise<string[]>;
577
+ /**
578
+ * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
579
+ *
580
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
581
+ * @returns An array of file paths matching the provided pattern(s)
582
+ */
583
+ globSync: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => string[];
584
+ /**
585
+ * A helper function to resolve modules using the Jiti resolver
586
+ *
587
+ * @remarks
588
+ * This function can be used to resolve modules relative to the project root directory.
589
+ *
590
+ * @example
591
+ * ```ts
592
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
593
+ * ```
594
+ *
595
+ * @param id - The module to resolve.
596
+ * @param importer - An optional path to the importer module.
597
+ * @param options - Additional resolution options.
598
+ * @returns A promise that resolves to the resolved module path.
599
+ */
600
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<string | undefined>;
601
+ /**
602
+ * A synchronous helper function to resolve modules using the Jiti resolver
603
+ *
604
+ * @remarks
605
+ * This function can be used to resolve modules relative to the project root directory.
606
+ *
607
+ * @example
608
+ * ```ts
609
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
610
+ * ```
611
+ *
612
+ * @param id - The module to resolve.
613
+ * @param importer - An optional path to the importer module.
614
+ * @param options - Additional resolution options.
615
+ * @returns The resolved module path.
616
+ */
617
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
618
+ /**
619
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
620
+ */
621
+ dispose: () => Promise<void>;
622
+ }
623
+ //#endregion
624
+ //#region ../powerlines/src/types/commands.d.ts
625
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
626
+ type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
627
+ //#endregion
628
+ //#region ../powerlines/src/types/resolved.d.ts
629
+ interface ResolvedEntryTypeDefinition extends TypeDefinition {
630
+ /**
631
+ * The user provided entry point in the source code
632
+ */
633
+ input: TypeDefinition;
634
+ /**
635
+ * An optional name to use in the package export during the build process
636
+ */
637
+ output?: string;
638
+ }
639
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
640
+ /**
641
+ * The name of the environment
642
+ */
643
+ name: string;
644
+ /**
645
+ * Configuration options for the preview server
646
+ */
647
+ preview?: ResolvedPreviewOptions;
648
+ };
649
+ type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
650
+ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
651
+ assets: ResolvedAssetGlob[];
652
+ }> & Pick<OutputConfig, "storage">;
653
+ /**
654
+ * The resolved options for the Powerlines project configuration.
655
+ */
656
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
657
+ /**
658
+ * The configuration options that were provided inline to the Powerlines CLI.
659
+ */
660
+ inlineConfig: InlineConfig<TUserConfig>;
661
+ /**
662
+ * The original configuration options that were provided by the user to the Powerlines process.
663
+ */
664
+ userConfig: TUserConfig;
665
+ /**
666
+ * A string identifier for the Powerlines command being executed.
667
+ */
668
+ command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
669
+ /**
670
+ * The root directory of the project's source code
671
+ *
672
+ * @defaultValue "\{projectRoot\}/src"
673
+ */
674
+ sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
675
+ /**
676
+ * The root directory of the project.
677
+ */
678
+ projectRoot: NonUndefined<TUserConfig["root"]>;
679
+ /**
680
+ * The type of project being built.
681
+ */
682
+ projectType: NonUndefined<TUserConfig["type"]>;
683
+ /**
684
+ * The output configuration options to use for the build process
685
+ */
686
+ output: OutputResolvedConfig;
687
+ /**
688
+ * Configuration provided to build processes
689
+ *
690
+ * @remarks
691
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
692
+ */
693
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
694
+ /**
695
+ * The log level to use for the Powerlines processes.
696
+ *
697
+ * @defaultValue "info"
698
+ */
699
+ logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
700
+ };
701
+ type RollupResolvedConfig = ResolvedConfig<RollupUserConfig>;
702
+ //#endregion
703
+ //#region ../powerlines/src/types/plugin.d.ts
704
+ interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
705
+ /**
706
+ * The order in which the plugin should be applied.
707
+ */
708
+ order?: "pre" | "post" | null | undefined;
709
+ /**
710
+ * A filter to determine when the hook should be called.
711
+ */
712
+ filter?: Pick<HookFilter, TFilter>;
713
+ /**
714
+ * The hook function to be called.
715
+ */
716
+ handler: THookFunction;
717
+ }
718
+ type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
719
+ /**
720
+ * A result returned by the plugin from the `types` hook that describes the declaration types output file.
721
+ */
722
+ interface TypesResult {
723
+ directives?: string[];
724
+ code: string;
725
+ }
726
+ type DeepPartial$1<T> = { [K in keyof T]?: DeepPartial$1<T[K]> };
727
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial$1<TContext["config"]> & Record<string, any>;
728
+ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
729
+ /**
730
+ * A function that returns configuration options to be merged with the build context's options.
731
+ *
732
+ * @remarks
733
+ * 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.
734
+ *
735
+ * @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.
736
+ *
737
+ * @see https://vitejs.dev/guide/api-plugin#config
738
+ *
739
+ * @param this - The build context.
740
+ * @param config - The partial configuration object to be modified.
741
+ * @returns A promise that resolves to a partial configuration object.
742
+ */
743
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
744
+ /**
745
+ * 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.
746
+ *
747
+ * @remarks
748
+ * 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.
749
+ *
750
+ * @see https://vitejs.dev/guide/api-plugin#configenvironment
751
+ *
752
+ * @param this - The build context.
753
+ * @param name - The name of the environment being configured.
754
+ * @param environment - The Vite-like environment object containing information about the current build environment.
755
+ * @returns A promise that resolves when the hook is complete.
756
+ */
757
+ configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
758
+ /**
759
+ * A hook that is called when the plugin is resolved.
760
+ *
761
+ * @see https://vitejs.dev/guide/api-plugin#configresolved
762
+ *
763
+ * @param this - The build context.
764
+ * @returns A promise that resolves when the hook is complete.
765
+ */
766
+ configResolved: (this: TContext) => MaybePromise<void>;
767
+ /**
768
+ * 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.
769
+ *
770
+ * @param this - The build context.
771
+ * @param code - The source code to generate types for.
772
+ * @returns A promise that resolves when the hook is complete.
773
+ */
774
+ types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
775
+ /**
776
+ * A hook that is called at the start of the build process.
777
+ *
778
+ * @param this - The build context and unplugin build context.
779
+ * @returns A promise that resolves when the hook is complete.
780
+ */
781
+ buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
782
+ /**
783
+ * A hook that is called at the end of the build process.
784
+ *
785
+ * @param this - The build context and unplugin build context.
786
+ * @returns A promise that resolves when the hook is complete.
787
+ */
788
+ buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
789
+ /**
790
+ * A hook that is called to transform the source code.
791
+ *
792
+ * @param this - The build context, unplugin build context, and unplugin context.
793
+ * @param code - The source code to transform.
794
+ * @param id - The identifier of the source code.
795
+ * @returns A promise that resolves when the hook is complete.
796
+ */
797
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
798
+ /**
799
+ * A hook that is called to load the source code.
800
+ *
801
+ * @param this - The build context, unplugin build context, and unplugin context.
802
+ * @param id - The identifier of the source code.
803
+ * @returns A promise that resolves when the hook is complete.
804
+ */
805
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
806
+ /**
807
+ * A hook that is called to resolve the identifier of the source code.
808
+ *
809
+ * @param this - The build context, unplugin build context, and unplugin context.
810
+ * @param id - The identifier of the source code.
811
+ * @param importer - The importer of the source code.
812
+ * @param options - The options for resolving the identifier.
813
+ * @returns A promise that resolves when the hook is complete.
814
+ */
815
+ resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
816
+ isEntry: boolean;
817
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>;
818
+ /**
819
+ * A hook that is called to write the bundle to disk.
820
+ *
821
+ * @param this - The build context.
822
+ * @returns A promise that resolves when the hook is complete.
823
+ */
824
+ writeBundle: (this: TContext) => MaybePromise<void>;
825
+ }
826
+ type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant$1 extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant$1] = Required<UnpluginOptions>[TBuildVariant$1]> = { [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey] };
827
+ type PluginHooks<TContext extends PluginContext = PluginContext> = { [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]> } & {
828
+ /**
829
+ * A function that returns configuration options to be merged with the build context's options.
830
+ *
831
+ * @remarks
832
+ * 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.
833
+ *
834
+ * @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.
835
+ *
836
+ * @see https://vitejs.dev/guide/api-plugin#config
837
+ *
838
+ * @param this - The build context.
839
+ * @param config - The partial configuration object to be modified.
840
+ * @returns A promise that resolves to a partial configuration object.
841
+ */
842
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
843
+ /**
844
+ * A hook that is called to transform the source code.
845
+ *
846
+ * @param this - The build context, unplugin build context, and unplugin context.
847
+ * @param code - The source code to transform.
848
+ * @param id - The identifier of the source code.
849
+ * @returns A promise that resolves when the hook is complete.
850
+ */
851
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
852
+ /**
853
+ * A hook that is called to load the source code.
854
+ *
855
+ * @param this - The build context, unplugin build context, and unplugin context.
856
+ * @param id - The identifier of the source code.
857
+ * @returns A promise that resolves when the hook is complete.
858
+ */
859
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
860
+ /**
861
+ * A hook that is called to resolve the identifier of the source code.
862
+ *
863
+ * @param this - The build context, unplugin build context, and unplugin context.
864
+ * @param id - The identifier of the source code.
865
+ * @param importer - The importer of the source code.
866
+ * @param options - The options for resolving the identifier.
867
+ * @returns A promise that resolves when the hook is complete.
868
+ */
869
+ resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
870
+ isEntry: boolean;
871
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
872
+ };
873
+ type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = { [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant> };
874
+ interface Plugin<in out TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
875
+ /**
876
+ * The name of the plugin, for use in deduplication, error messages and logs.
877
+ */
878
+ name: string;
879
+ /**
880
+ * An API object that can be used for inter-plugin communication.
881
+ *
882
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
883
+ */
884
+ api?: Record<string, any>;
885
+ /**
886
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
887
+ *
888
+ * @remarks
889
+ * The Plugin invocation order is as follows:
890
+ * - `enforce: 'pre'` plugins
891
+ * - `order: 'pre'` plugin hooks
892
+ * - any other plugins (normal)
893
+ * - `order: 'post'` plugin hooks
894
+ * - `enforce: 'post'` plugins
895
+ *
896
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
897
+ * @see https://rollupjs.org/plugin-development/#build-hooks
898
+ * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
899
+ * @see https://esbuild.github.io/plugins/#concepts
900
+ */
901
+ enforce?: "pre" | "post";
902
+ /**
903
+ * A function to determine if two plugins are the same and can be de-duplicated.
904
+ *
905
+ * @remarks
906
+ * If this is not provided, plugins are de-duplicated by comparing their names.
907
+ *
908
+ * @param other - The other plugin to compare against.
909
+ * @returns `true` if the two plugins are the same, `false` otherwise.
910
+ */
911
+ dedupe?: false | ((other: Plugin<any>) => boolean);
912
+ /**
913
+ * A list of pre-requisite plugins that must be loaded before this plugin can be used.
914
+ */
915
+ dependsOn?: PluginConfig<any>[];
916
+ /**
917
+ * Define environments where this plugin should be active. By default, the plugin is active in all environments.
918
+ *
919
+ * @param environment - The environment to check.
920
+ * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
921
+ */
922
+ applyToEnvironment?: (environment: EnvironmentResolvedConfig) => MaybePromise<boolean | Plugin<TContext>>;
923
+ }
924
+ //#endregion
925
+ //#region ../powerlines/src/types/tsconfig.d.ts
926
+ type ReflectionMode = "default" | "explicit" | "never";
927
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
928
+ /**
929
+ * Defines the level of reflection to be used during the transpilation process.
930
+ *
931
+ * @remarks
932
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
933
+ * - `minimal` - Only the essential type information is captured.
934
+ * - `normal` - Additional type information is captured, including some contextual data.
935
+ * - `verbose` - All available type information is captured, including detailed contextual data.
936
+ */
937
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
938
+ interface DeepkitOptions {
939
+ /**
940
+ * Either true to activate reflection for all files compiled using this tsconfig,
941
+ * or a list of globs/file paths relative to this tsconfig.json.
942
+ * Globs/file paths can be prefixed with a ! to exclude them.
943
+ */
944
+ reflection?: RawReflectionMode;
945
+ /**
946
+ * Defines the level of reflection to be used during the transpilation process.
947
+ *
948
+ * @remarks
949
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
950
+ * - `minimal` - Only the essential type information is captured.
951
+ * - `normal` - Additional type information is captured, including some contextual data.
952
+ * - `verbose` - All available type information is captured, including detailed contextual data.
953
+ */
954
+ reflectionLevel?: ReflectionLevel;
955
+ }
956
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
957
+ /**
958
+ * The TypeScript compiler configuration.
959
+ *
960
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
961
+ */
962
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
963
+ /**
964
+ * Either true to activate reflection for all files compiled using this tsconfig,
965
+ * or a list of globs/file paths relative to this tsconfig.json.
966
+ * Globs/file paths can be prefixed with a ! to exclude them.
967
+ */
968
+ reflection?: RawReflectionMode;
969
+ /**
970
+ * Defines the level of reflection to be used during the transpilation process.
971
+ *
972
+ * @remarks
973
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
974
+ * - `minimal` - Only the essential type information is captured.
975
+ * - `normal` - Additional type information is captured, including some contextual data.
976
+ * - `verbose` - All available type information is captured, including detailed contextual data.
977
+ */
978
+ reflectionLevel?: ReflectionLevel;
979
+ /**
980
+ * Instructs the TypeScript compiler how to compile `.ts` files.
981
+ */
982
+ compilerOptions?: TSCompilerOptions;
983
+ }
984
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
985
+ originalTsconfigJson: TsConfigJson;
986
+ tsconfigJson: TSConfig;
987
+ tsconfigFilePath: string;
988
+ };
989
+ //#endregion
990
+ //#region ../powerlines/src/types/config.d.ts
991
+ type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
992
+ /**
993
+ * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
994
+ */
995
+ type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
996
+ type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext>>;
997
+ /**
998
+ * A configuration tuple for a Powerlines plugin.
999
+ */
1000
+ type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
1001
+ /**
1002
+ * A configuration object for a Powerlines plugin.
1003
+ */
1004
+ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
1005
+ plugin: string | PluginFactory<TContext, TOptions>;
1006
+ options: TOptions;
1007
+ } | {
1008
+ plugin: Plugin<TContext>;
1009
+ options?: never;
1010
+ };
1011
+ /**
1012
+ * A configuration tuple for a Powerlines plugin.
1013
+ */
1014
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | Promise<Plugin<TContext>> | PluginConfigTuple<TContext> | PluginConfigObject<TContext>;
1015
+ type ProjectType = "application" | "library";
1016
+ interface DeployConfig {
1017
+ /**
1018
+ * The deployment variant being used by the Powerlines engine.
1019
+ *
1020
+ * @example
1021
+ * ```ts
1022
+ * export default defineConfig({
1023
+ * deploy: {
1024
+ * variant: "cloudflare"
1025
+ * }
1026
+ * });
1027
+ *
1028
+ * ```
1029
+ */
1030
+ variant?: string;
1031
+ }
1032
+ interface OutputConfig {
1033
+ /**
1034
+ * The path to output the final compiled files to
1035
+ *
1036
+ * @remarks
1037
+ * If a value is not provided, Powerlines will attempt to:
1038
+ * 1. Use the `outDir` value in the `tsconfig.json` file.
1039
+ * 2. Use the `dist` directory in the project root directory.
1040
+ *
1041
+ * @defaultValue "dist/\{projectRoot\}"
1042
+ */
1043
+ outputPath?: string;
1044
+ /**
1045
+ * The output directory path for the project build.
1046
+ *
1047
+ * @remarks
1048
+ * 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.
1049
+ *
1050
+ * @defaultValue "\{projectRoot\}/dist"
1051
+ */
1052
+ buildPath?: string;
1053
+ /**
1054
+ * The folder where the generated runtime artifacts will be located
1055
+ *
1056
+ * @remarks
1057
+ * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
1058
+ *
1059
+ * @defaultValue "\{projectRoot\}/.powerlines"
1060
+ */
1061
+ artifactsPath?: string;
1062
+ /**
1063
+ * The path of the generated runtime declaration file relative to the workspace root.
1064
+ *
1065
+ * @defaultValue "\{projectRoot\}/powerlines.d.ts"
1066
+ */
1067
+ dts?: string | false;
1068
+ /**
1069
+ * A prefix to use for identifying builtin modules
1070
+ *
1071
+ * @remarks
1072
+ * 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"`.
1073
+ *
1074
+ * @defaultValue "powerlines"
1075
+ */
1076
+ builtinPrefix?: string;
1077
+ /**
1078
+ * The module format of the output files
1079
+ *
1080
+ * @remarks
1081
+ * 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.
1082
+ *
1083
+ * @defaultValue "esm"
1084
+ */
1085
+ format?: Format | Format[];
1086
+ /**
1087
+ * A list of assets to copy to the output directory
1088
+ *
1089
+ * @remarks
1090
+ * 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.
1091
+ */
1092
+ assets?: Array<string | AssetGlob>;
1093
+ /**
1094
+ * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
1095
+ *
1096
+ * @remarks
1097
+ * If a string preset is provided, it must be one of the following values:
1098
+ * - `"virtual"`: Uses the local file system for storage.
1099
+ * - `"fs"`: Uses an in-memory virtual file system for storage.
1100
+ *
1101
+ * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
1102
+ *
1103
+ * @defaultValue "virtual"
1104
+ */
1105
+ storage?: StoragePort | StoragePreset;
1106
+ }
1107
+ interface BaseConfig {
1108
+ /**
1109
+ * The entry point(s) for the application
1110
+ */
1111
+ entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
1112
+ /**
1113
+ * Configuration for the output of the build process
1114
+ */
1115
+ output?: OutputConfig;
1116
+ /**
1117
+ * Configuration for cleaning the build artifacts
1118
+ *
1119
+ * @remarks
1120
+ * If set to `false`, the cleaning process will be disabled.
1121
+ */
1122
+ clean?: Record<string, any> | false;
1123
+ /**
1124
+ * Configuration for linting the source code
1125
+ *
1126
+ * @remarks
1127
+ * If set to `false`, linting will be disabled.
1128
+ */
1129
+ lint?: Record<string, any> | false;
1130
+ /**
1131
+ * Configuration for testing the source code
1132
+ *
1133
+ * @remarks
1134
+ * If set to `false`, testing will be disabled.
1135
+ */
1136
+ test?: Record<string, any> | false;
1137
+ /**
1138
+ * Configuration for the transformation of the source code
1139
+ */
1140
+ transform?: Record<string, any>;
1141
+ /**
1142
+ * Configuration provided to build processes
1143
+ *
1144
+ * @remarks
1145
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1146
+ */
1147
+ build?: BuildConfig;
1148
+ /**
1149
+ * Configuration for documentation generation
1150
+ *
1151
+ * @remarks
1152
+ * This configuration will be used by the documentation generation plugins during the `docs` command.
1153
+ */
1154
+ docs?: Record<string, any>;
1155
+ /**
1156
+ * Configuration for deploying the source code
1157
+ *
1158
+ * @remarks
1159
+ * If set to `false`, the deployment will be disabled.
1160
+ */
1161
+ deploy?: DeployConfig | false;
1162
+ /**
1163
+ * The path to the tsconfig file to be used by the compiler
1164
+ *
1165
+ * @remarks
1166
+ * 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).
1167
+ *
1168
+ * @defaultValue "\{projectRoot\}/tsconfig.json"
1169
+ */
1170
+ tsconfig?: string;
1171
+ /**
1172
+ * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
1173
+ *
1174
+ * @see https://www.typescriptlang.org/tsconfig
1175
+ *
1176
+ * @remarks
1177
+ * If populated, this option takes higher priority than `tsconfig`
1178
+ */
1179
+ tsconfigRaw?: TSConfig;
1180
+ }
1181
+ interface EnvironmentConfig extends BaseConfig {
1182
+ /**
1183
+ * Configuration options for the preview server
1184
+ */
1185
+ preview?: PreviewOptions;
1186
+ /**
1187
+ * A flag indicating whether the build is for a Server-Side Rendering environment.
1188
+ */
1189
+ ssr?: boolean;
1190
+ /**
1191
+ * Define if this environment is used for Server-Side Rendering
1192
+ *
1193
+ * @defaultValue "server" (if it isn't the client environment)
1194
+ */
1195
+ consumer?: "client" | "server";
1196
+ }
1197
+ interface CommonUserConfig extends BaseConfig {
1198
+ /**
1199
+ * The name of the project
1200
+ */
1201
+ name?: string;
1202
+ /**
1203
+ * The project display title
1204
+ *
1205
+ * @remarks
1206
+ * This option is used in documentation generation and other places where a human-readable title is needed.
1207
+ */
1208
+ title?: string;
1209
+ /**
1210
+ * A description of the project
1211
+ *
1212
+ * @remarks
1213
+ * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
1214
+ */
1215
+ description?: string;
1216
+ /**
1217
+ * The log level to use for the Powerlines processes.
1218
+ *
1219
+ * @defaultValue "info"
1220
+ */
1221
+ logLevel?: LogLevelLabel | null;
1222
+ /**
1223
+ * A custom logger function to use for logging messages
1224
+ */
1225
+ customLogger?: LogFn;
1226
+ /**
1227
+ * 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.
1228
+ *
1229
+ * @defaultValue "production"
1230
+ */
1231
+ mode?: "development" | "test" | "production";
1232
+ /**
1233
+ * The type of project being built
1234
+ *
1235
+ * @defaultValue "application"
1236
+ */
1237
+ type?: ProjectType;
1238
+ /**
1239
+ * The root directory of the project
1240
+ */
1241
+ root: string;
1242
+ /**
1243
+ * The root directory of the project's source code
1244
+ *
1245
+ * @defaultValue "\{root\}/src"
1246
+ */
1247
+ sourceRoot?: string;
1248
+ /**
1249
+ * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
1250
+ *
1251
+ * @remarks
1252
+ * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
1253
+ */
1254
+ configFile?: string;
1255
+ /**
1256
+ * Should the Powerlines CLI processes skip installing missing packages?
1257
+ *
1258
+ * @remarks
1259
+ * This option is useful for CI/CD environments where the installation of packages is handled by a different process.
1260
+ *
1261
+ * @defaultValue false
1262
+ */
1263
+ skipInstalls?: boolean;
1264
+ /**
1265
+ * Should the compiler processes skip any improvements that make use of cache?
1266
+ *
1267
+ * @defaultValue false
1268
+ */
1269
+ skipCache?: boolean;
1270
+ /**
1271
+ * A list of resolvable paths to plugins used during the build process
1272
+ */
1273
+ plugins?: PluginConfig<PluginContext<any>>[];
1274
+ /**
1275
+ * Environment-specific configurations
1276
+ */
1277
+ environments?: Record<string, EnvironmentConfig>;
1278
+ /**
1279
+ * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
1280
+ *
1281
+ * @remarks
1282
+ * 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.
1283
+ *
1284
+ * @defaultValue "powerlines"
1285
+ */
1286
+ framework?: string;
1287
+ }
1288
+ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant$1 extends string = any> extends Omit<CommonUserConfig, "build"> {
1289
+ /**
1290
+ * Configuration provided to build processes
1291
+ *
1292
+ * @remarks
1293
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1294
+ */
1295
+ build: Omit<TBuildConfig, "override"> & {
1296
+ /**
1297
+ * The build variant being used by the Powerlines engine.
1298
+ */
1299
+ variant?: TBuildVariant$1;
1300
+ /**
1301
+ * An optional set of override options to apply to the selected build variant.
1302
+ *
1303
+ * @remarks
1304
+ * 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.
1305
+ */
1306
+ override?: Partial<TBuildResolvedConfig>;
1307
+ };
1308
+ }
1309
+ type RollupUserConfig = UserConfig<RollupBuildConfig, RollupResolvedBuildConfig, "rollup">;
1310
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
1311
+ /**
1312
+ * The configuration provided while executing Powerlines commands.
1313
+ */
1314
+ type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
1315
+ /**
1316
+ * A string identifier for the Powerlines command being executed
1317
+ */
1318
+ command: PowerlinesCommand;
1319
+ };
1320
+ //#endregion
1321
+ //#region ../powerlines/src/types/context.d.ts
1322
+ interface MetaInfo {
1323
+ /**
1324
+ * The checksum generated from the resolved options
1325
+ */
1326
+ checksum: string;
1327
+ /**
1328
+ * The build id
1329
+ */
1330
+ buildId: string;
1331
+ /**
1332
+ * The release id
1333
+ */
1334
+ releaseId: string;
1335
+ /**
1336
+ * The build timestamp
1337
+ */
1338
+ timestamp: number;
1339
+ /**
1340
+ * A hash that represents the path to the project root directory
1341
+ */
1342
+ projectRootHash: string;
1343
+ /**
1344
+ * A hash that represents the path to the project root directory
1345
+ */
1346
+ configHash: string;
1347
+ }
1348
+ interface Resolver extends Jiti {
1349
+ plugin: Jiti;
1350
+ }
1351
+ interface TransformResult$1 {
1352
+ code: string;
1353
+ map: SourceMap | null;
1354
+ }
1355
+ interface InitContextOptions {
1356
+ /**
1357
+ * If false, the plugin will be loaded after all other plugins.
1358
+ *
1359
+ * @defaultValue true
1360
+ */
1361
+ isHighPriority: boolean;
1362
+ }
1363
+ interface FetchOptions extends FetchRequestOptions {
1364
+ /**
1365
+ * An indicator specifying that the request should bypass any caching
1366
+ */
1367
+ skipCache?: boolean;
1368
+ }
1369
+ interface ParseOptions extends ParserOptions {
1370
+ /**
1371
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1372
+ */
1373
+ allowReturnOutsideFunction?: boolean;
1374
+ }
1375
+ /**
1376
+ * The unresolved Powerlines context.
1377
+ *
1378
+ * @remarks
1379
+ * This context is used before the user configuration has been fully resolved after the `config`.
1380
+ */
1381
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1382
+ /**
1383
+ * The Storm workspace configuration
1384
+ */
1385
+ workspaceConfig: WorkspaceConfig;
1386
+ /**
1387
+ * An object containing the options provided to Powerlines
1388
+ */
1389
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1390
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1391
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1392
+ output: TResolvedConfig["output"];
1393
+ };
1394
+ /**
1395
+ * A logging function for the Powerlines engine
1396
+ */
1397
+ log: LogFn;
1398
+ /**
1399
+ * A logging function for fatal messages
1400
+ */
1401
+ fatal: (message: string | UnpluginMessage) => void;
1402
+ /**
1403
+ * A logging function for error messages
1404
+ */
1405
+ error: (message: string | UnpluginMessage) => void;
1406
+ /**
1407
+ * A logging function for warning messages
1408
+ */
1409
+ warn: (message: string | UnpluginMessage) => void;
1410
+ /**
1411
+ * A logging function for informational messages
1412
+ */
1413
+ info: (message: string | UnpluginMessage) => void;
1414
+ /**
1415
+ * A logging function for debug messages
1416
+ */
1417
+ debug: (message: string | UnpluginMessage) => void;
1418
+ /**
1419
+ * A logging function for trace messages
1420
+ */
1421
+ trace: (message: string | UnpluginMessage) => void;
1422
+ /**
1423
+ * The metadata information
1424
+ */
1425
+ meta: MetaInfo;
1426
+ /**
1427
+ * The metadata information currently written to disk
1428
+ */
1429
+ persistedMeta?: MetaInfo;
1430
+ /**
1431
+ * The Powerlines artifacts directory
1432
+ */
1433
+ artifactsPath: string;
1434
+ /**
1435
+ * The path to the Powerlines builtin runtime modules directory
1436
+ */
1437
+ builtinsPath: string;
1438
+ /**
1439
+ * The path to the Powerlines entry modules directory
1440
+ */
1441
+ entryPath: string;
1442
+ /**
1443
+ * The path to the Powerlines TypeScript declaration files directory
1444
+ */
1445
+ dtsPath: string;
1446
+ /**
1447
+ * The path to a directory where the reflection data buffers (used by the build processes) are stored
1448
+ */
1449
+ dataPath: string;
1450
+ /**
1451
+ * The path to a directory where the project cache (used by the build processes) is stored
1452
+ */
1453
+ cachePath: string;
1454
+ /**
1455
+ * The Powerlines environment paths
1456
+ */
1457
+ envPaths: EnvPaths;
1458
+ /**
1459
+ * The file system path to the Powerlines package installation
1460
+ */
1461
+ powerlinesPath: string;
1462
+ /**
1463
+ * The relative path to the Powerlines workspace root directory
1464
+ */
1465
+ relativeToWorkspaceRoot: string;
1466
+ /**
1467
+ * The project's `package.json` file content
1468
+ */
1469
+ packageJson: PackageJson & Record<string, any>;
1470
+ /**
1471
+ * The project's `project.json` file content
1472
+ */
1473
+ projectJson?: Record<string, any>;
1474
+ /**
1475
+ * The dependency installations required by the project
1476
+ */
1477
+ dependencies: Record<string, string | Range>;
1478
+ /**
1479
+ * The development dependency installations required by the project
1480
+ */
1481
+ devDependencies: Record<string, string | Range>;
1482
+ /**
1483
+ * The parsed TypeScript configuration from the `tsconfig.json` file
1484
+ */
1485
+ tsconfig: ParsedTypeScriptConfig;
1486
+ /**
1487
+ * The entry points of the source code
1488
+ */
1489
+ entry: ResolvedEntryTypeDefinition[];
1490
+ /**
1491
+ * The virtual file system manager used during the build process to reference generated runtime files
1492
+ */
1493
+ fs: VirtualFileSystemInterface;
1494
+ /**
1495
+ * The Jiti module resolver
1496
+ */
1497
+ resolver: Resolver;
1498
+ /**
1499
+ * The builtin module id that exist in the Powerlines virtual file system
1500
+ */
1501
+ builtins: string[];
1502
+ /**
1503
+ * The {@link Project} instance used for type reflection and module manipulation
1504
+ *
1505
+ * @see https://ts-morph.com/
1506
+ *
1507
+ * @remarks
1508
+ * This instance is created lazily on first access.
1509
+ */
1510
+ program: Project;
1511
+ /**
1512
+ * A function to perform HTTP fetch requests
1513
+ *
1514
+ * @remarks
1515
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1516
+ *
1517
+ * @example
1518
+ * ```ts
1519
+ * const response = await context.fetch("https://api.example.com/data");
1520
+ * const data = await response.json();
1521
+ * ```
1522
+ *
1523
+ * @see https://github.com/nodejs/undici
1524
+ *
1525
+ * @param input - The URL to fetch.
1526
+ * @param options - The fetch request options.
1527
+ * @returns A promise that resolves to a response returned by the fetch.
1528
+ */
1529
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1530
+ /**
1531
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1532
+ *
1533
+ * @remarks
1534
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1535
+ *
1536
+ * @example
1537
+ * ```ts
1538
+ * const ast = context.parse("const x: number = 42;");
1539
+ * ```
1540
+ *
1541
+ * @see https://rollupjs.org/plugin-development/#this-parse
1542
+ * @see https://github.com/oxc/oxc
1543
+ *
1544
+ * @param code - The source code to parse.
1545
+ * @param options - The options to pass to the parser.
1546
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1547
+ */
1548
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1549
+ /**
1550
+ * A helper function to resolve modules using the Jiti resolver
1551
+ *
1552
+ * @remarks
1553
+ * This function can be used to resolve modules relative to the project root directory.
1554
+ *
1555
+ * @example
1556
+ * ```ts
1557
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1558
+ * ```
1559
+ *
1560
+ * @param id - The module to resolve.
1561
+ * @param importer - An optional path to the importer module.
1562
+ * @param options - Additional resolution options.
1563
+ * @returns A promise that resolves to the resolved module path.
1564
+ */
1565
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<ExternalIdResult | undefined>;
1566
+ /**
1567
+ * A helper function to load modules using the Jiti resolver
1568
+ *
1569
+ * @remarks
1570
+ * This function can be used to load modules relative to the project root directory.
1571
+ *
1572
+ * @example
1573
+ * ```ts
1574
+ * const module = await context.load("some-module", "/path/to/importer");
1575
+ * ```
1576
+ *
1577
+ * @param id - The module to load.
1578
+ * @returns A promise that resolves to the loaded module.
1579
+ */
1580
+ load: (id: string) => Promise<TransformResult$1 | undefined>;
1581
+ /**
1582
+ * The Powerlines builtin virtual files
1583
+ */
1584
+ getBuiltins: () => Promise<VirtualFile[]>;
1585
+ /**
1586
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1587
+ *
1588
+ * @param code - The source code of the builtin file
1589
+ * @param id - The unique identifier of the builtin file
1590
+ * @param path - An optional path to write the builtin file to
1591
+ */
1592
+ emitBuiltin: (code: string, id: string, path?: string) => Promise<void>;
1593
+ /**
1594
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1595
+ *
1596
+ * @param code - The source code of the entry file
1597
+ * @param path - An optional path to write the entry file to
1598
+ */
1599
+ emitEntry: (code: string, path: string) => Promise<void>;
1600
+ /**
1601
+ * A function to update the context fields using a new user configuration options
1602
+ */
1603
+ withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1604
+ /**
1605
+ * A function to update the context fields using inline configuration options
1606
+ */
1607
+ withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1608
+ /**
1609
+ * Create a new logger instance
1610
+ *
1611
+ * @param name - The name to use for the logger instance
1612
+ * @returns A logger function
1613
+ */
1614
+ createLog: (name: string | null) => LogFn;
1615
+ /**
1616
+ * Extend the current logger instance with a new name
1617
+ *
1618
+ * @param name - The name to use for the extended logger instance
1619
+ * @returns A logger function
1620
+ */
1621
+ extendLog: (name: string) => LogFn;
1622
+ /**
1623
+ * Generates a checksum representing the current context state
1624
+ *
1625
+ * @returns A promise that resolves to a string representing the checksum
1626
+ */
1627
+ generateChecksum: () => Promise<string>;
1628
+ }
1629
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1630
+ /**
1631
+ * The fully resolved Powerlines configuration
1632
+ */
1633
+ config: TResolvedConfig;
1634
+ };
1635
+ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1636
+ /**
1637
+ * The environment specific resolved configuration
1638
+ */
1639
+ environment: EnvironmentResolvedConfig;
1640
+ /**
1641
+ * An alternative property name for the {@link log} property
1642
+ *
1643
+ * @remarks
1644
+ * This is provided for compatibility with other logging libraries that expect a `logger` property.
1645
+ */
1646
+ logger: LogFn;
1647
+ }
1648
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1649
+ //#endregion
1650
+ //#region src/types/plugin.d.ts
1651
+ type RollupPluginOptions = Partial<RollupBuildConfig>;
1652
+ type RollupPluginResolvedConfig = RollupResolvedConfig;
1653
+ type RollupPluginContext<TResolvedConfig extends RollupPluginResolvedConfig = RollupPluginResolvedConfig> = PluginContext<TResolvedConfig>;
1654
+ declare type __ΩRollupPluginOptions = any[];
1655
+ declare type __ΩRollupPluginResolvedConfig = any[];
1656
+ declare type __ΩRollupPluginContext = any[];
1657
+ //#endregion
1658
+ export { __ΩRollupPluginOptions as a, __ΩRollupPluginContext as i, RollupPluginOptions as n, __ΩRollupPluginResolvedConfig as o, RollupPluginResolvedConfig as r, Plugin as s, RollupPluginContext as t };
1659
+ //# sourceMappingURL=plugin-ziWFtAvF.d.mts.map