@powerlines/plugin-automd 0.1.37 → 0.1.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-PDDoKC0s.d.cts → index-BPSp0dpG.d.cts} +186 -229
- package/dist/{index-FQy5XXDV.d.ts → index-D82q_V4k.d.ts} +186 -229
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +1 -2
- package/dist/types/plugin.d.cts +1 -2
- package/dist/types/plugin.d.ts +1 -2
- package/package.json +10 -10
|
@@ -14,7 +14,6 @@ import { Range } from 'semver';
|
|
|
14
14
|
import { Project } from 'ts-morph';
|
|
15
15
|
import { UnpluginMessage, ExternalIdResult, UnpluginContext, UnpluginBuildContext, TransformResult as TransformResult$1, HookFilter, UnpluginOptions } from 'unplugin';
|
|
16
16
|
import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
|
|
17
|
-
import { StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
|
|
18
17
|
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
|
|
19
18
|
import ts from 'typescript';
|
|
20
19
|
import { ArrayValues } from '@stryke/types/array';
|
|
@@ -156,9 +155,107 @@ interface BuildConfig {
|
|
|
156
155
|
}
|
|
157
156
|
type BuildResolvedConfig = Omit<BuildConfig, "override">;
|
|
158
157
|
|
|
159
|
-
declare
|
|
160
|
-
|
|
161
|
-
|
|
158
|
+
declare enum StoragePreset {
|
|
159
|
+
VIRTUAL = "virtual",
|
|
160
|
+
FS = "fs"
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Interface defining the methods and properties for a storage adapter.
|
|
164
|
+
*/
|
|
165
|
+
interface StorageAdapter {
|
|
166
|
+
/**
|
|
167
|
+
* A name identifying the storage adapter type.
|
|
168
|
+
*/
|
|
169
|
+
name: string;
|
|
170
|
+
/**
|
|
171
|
+
* Checks if a key exists in the storage.
|
|
172
|
+
*
|
|
173
|
+
* @param key - The key to check for existence.
|
|
174
|
+
* @returns A promise that resolves to `true` if the key exists, otherwise `false`.
|
|
175
|
+
*/
|
|
176
|
+
exists: (key: string) => Promise<boolean>;
|
|
177
|
+
/**
|
|
178
|
+
* Synchronously checks if a key exists in the storage.
|
|
179
|
+
*
|
|
180
|
+
* @param key - The key to check for existence.
|
|
181
|
+
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
182
|
+
*/
|
|
183
|
+
existsSync: (key: string) => boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Read a value associated with a key from the storage.
|
|
186
|
+
*
|
|
187
|
+
* @param key - The key to read the value for.
|
|
188
|
+
* @returns A promise that resolves to the value if found, otherwise `null`.
|
|
189
|
+
*/
|
|
190
|
+
get: (key: string) => Promise<string | null>;
|
|
191
|
+
/**
|
|
192
|
+
* Synchronously reads the value associated with a key from the storage.
|
|
193
|
+
*
|
|
194
|
+
* @param key - The key to read the value for.
|
|
195
|
+
* @returns The value if found, otherwise `null`.
|
|
196
|
+
*/
|
|
197
|
+
getSync: (key: string) => string | null;
|
|
198
|
+
/**
|
|
199
|
+
* Writes a value to the storage for the given key.
|
|
200
|
+
*
|
|
201
|
+
* @param key - The key to associate the value with.
|
|
202
|
+
* @param value - The value to store.
|
|
203
|
+
*/
|
|
204
|
+
set: (key: string, value: string) => Promise<void>;
|
|
205
|
+
/**
|
|
206
|
+
* Synchronously writes a value to the storage for the given key.
|
|
207
|
+
*
|
|
208
|
+
* @param key - The key to associate the value with.
|
|
209
|
+
* @param value - The value to store.
|
|
210
|
+
*/
|
|
211
|
+
setSync: (key: string, value: string) => void;
|
|
212
|
+
/**
|
|
213
|
+
* Removes a value from the storage.
|
|
214
|
+
*
|
|
215
|
+
* @param key - The key whose value should be removed.
|
|
216
|
+
*/
|
|
217
|
+
remove: (key: string) => Promise<void>;
|
|
218
|
+
/**
|
|
219
|
+
* Synchronously removes a value from the storage.
|
|
220
|
+
*
|
|
221
|
+
* @param key - The key whose value should be removed.
|
|
222
|
+
*/
|
|
223
|
+
removeSync: (key: string) => void;
|
|
224
|
+
/**
|
|
225
|
+
* Remove all entries from the storage that match the provided base path.
|
|
226
|
+
*
|
|
227
|
+
* @param base - The base path or prefix to clear entries from.
|
|
228
|
+
*/
|
|
229
|
+
clear: (base?: string) => Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Synchronously remove all entries from the storage that match the provided base path.
|
|
232
|
+
*
|
|
233
|
+
* @param base - The base path or prefix to clear entries from.
|
|
234
|
+
*/
|
|
235
|
+
clearSync: (base?: string) => void;
|
|
236
|
+
/**
|
|
237
|
+
* Lists all keys under the provided base path.
|
|
238
|
+
*
|
|
239
|
+
* @param base - The base path or prefix to list keys from.
|
|
240
|
+
* @returns A promise resolving to the list of keys.
|
|
241
|
+
*/
|
|
242
|
+
list: (base?: string) => Promise<string[]>;
|
|
243
|
+
/**
|
|
244
|
+
* Synchronously lists all keys under the provided base path.
|
|
245
|
+
*
|
|
246
|
+
* @param base - The base path or prefix to list keys from.
|
|
247
|
+
* @returns The list of keys.
|
|
248
|
+
*/
|
|
249
|
+
listSync: (base?: string) => string[];
|
|
250
|
+
/**
|
|
251
|
+
* Releases any resources held by the storage adapter.
|
|
252
|
+
*/
|
|
253
|
+
dispose: () => MaybePromise<void>;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
|
|
257
|
+
*/
|
|
258
|
+
type StoragePort = Record<string, StorageAdapter>;
|
|
162
259
|
interface VirtualFileMetadata {
|
|
163
260
|
/**
|
|
164
261
|
* The identifier for the file data.
|
|
@@ -178,10 +275,6 @@ interface VirtualFileMetadata {
|
|
|
178
275
|
* - `normal`: Indicates that the file is a standard file without any special role.
|
|
179
276
|
*/
|
|
180
277
|
type: string;
|
|
181
|
-
/**
|
|
182
|
-
* The output mode of the file.
|
|
183
|
-
*/
|
|
184
|
-
mode: string;
|
|
185
278
|
/**
|
|
186
279
|
* Additional metadata associated with the file.
|
|
187
280
|
*/
|
|
@@ -203,16 +296,9 @@ interface VirtualFileData {
|
|
|
203
296
|
* This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
|
|
204
297
|
* - `builtin`: Indicates that the file is a built-in module provided by the system.
|
|
205
298
|
* - `entry`: Indicates that the file is an entry point for execution.
|
|
206
|
-
* - `chunk`: Indicates that the file is a code chunk, typically used in code-splitting scenarios.
|
|
207
|
-
* - `prebuilt-chunk`: Indicates that the file is a prebuilt code chunk.
|
|
208
|
-
* - `asset`: Indicates that the file is a static asset, such as an image or stylesheet.
|
|
209
299
|
* - `normal`: Indicates that the file is a standard file without any special role.
|
|
210
300
|
*/
|
|
211
301
|
type?: string;
|
|
212
|
-
/**
|
|
213
|
-
* The output mode of the file.
|
|
214
|
-
*/
|
|
215
|
-
mode?: string;
|
|
216
302
|
/**
|
|
217
303
|
* Additional metadata associated with the file.
|
|
218
304
|
*/
|
|
@@ -228,21 +314,18 @@ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
|
|
|
228
314
|
*/
|
|
229
315
|
timestamp: number;
|
|
230
316
|
}
|
|
231
|
-
interface
|
|
232
|
-
mode?: OutputModeType;
|
|
233
|
-
}
|
|
234
|
-
type MakeDirectoryOptions = (Mode | MakeDirectoryOptions$1) & ResolveFSOptions;
|
|
235
|
-
interface PowerlinesWriteFileOptions extends ResolveFSOptions {
|
|
317
|
+
interface WriteOptions {
|
|
236
318
|
/**
|
|
237
319
|
* Should the file skip formatting before being written?
|
|
238
320
|
*
|
|
239
321
|
* @defaultValue false
|
|
240
322
|
*/
|
|
241
323
|
skipFormat?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Additional metadata for the file.
|
|
326
|
+
*/
|
|
327
|
+
meta?: VirtualFileMetadata;
|
|
242
328
|
}
|
|
243
|
-
type NodeWriteFileOptions = WriteFileOptions$1;
|
|
244
|
-
type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
|
|
245
|
-
type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
|
|
246
329
|
interface ResolveOptions extends ResolveOptions$1 {
|
|
247
330
|
/**
|
|
248
331
|
* If true, the module is being resolved as an entry point.
|
|
@@ -266,14 +349,6 @@ interface ResolveOptions extends ResolveOptions$1 {
|
|
|
266
349
|
skipNodeModulesBundle?: boolean;
|
|
267
350
|
}
|
|
268
351
|
interface VirtualFileSystemInterface {
|
|
269
|
-
/**
|
|
270
|
-
* Patches the File System to include the virtual file system (VFS) contents.
|
|
271
|
-
*/
|
|
272
|
-
[__VFS_PATCH__]: () => void;
|
|
273
|
-
/**
|
|
274
|
-
* Reverts the virtual file system (VFS) to its previous state.
|
|
275
|
-
*/
|
|
276
|
-
[__VFS_REVERT__]: () => void;
|
|
277
352
|
/**
|
|
278
353
|
* The underlying file metadata.
|
|
279
354
|
*/
|
|
@@ -286,208 +361,92 @@ interface VirtualFileSystemInterface {
|
|
|
286
361
|
* A map of module ids to their file paths.
|
|
287
362
|
*/
|
|
288
363
|
paths: Readonly<Record<string, string>>;
|
|
289
|
-
/**
|
|
290
|
-
* Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
291
|
-
*
|
|
292
|
-
* @param pathOrId - The path or id to check.
|
|
293
|
-
* @param importer - The importer path, if any.
|
|
294
|
-
* @param options - Optional parameters for resolving the path.
|
|
295
|
-
* @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
|
|
296
|
-
*/
|
|
297
|
-
isVirtual: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
|
|
298
|
-
/**
|
|
299
|
-
* Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
300
|
-
*
|
|
301
|
-
* @param pathOrId - The path or id to check.
|
|
302
|
-
* @param importer - The importer path, if any.
|
|
303
|
-
* @param options - Optional parameters for resolving the path.
|
|
304
|
-
* @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
|
|
305
|
-
*/
|
|
306
|
-
isPhysical: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
|
|
307
364
|
/**
|
|
308
365
|
* Checks if a file exists in the virtual file system (VFS).
|
|
309
366
|
*
|
|
310
|
-
* @param path - The path of the file
|
|
367
|
+
* @param path - The path or id of the file.
|
|
311
368
|
* @returns `true` if the file exists, otherwise `false`.
|
|
312
369
|
*/
|
|
313
|
-
|
|
370
|
+
exists: (path: string) => Promise<boolean>;
|
|
314
371
|
/**
|
|
315
|
-
* Checks if a
|
|
372
|
+
* Synchronously Checks if a file exists in the virtual file system (VFS).
|
|
316
373
|
*
|
|
317
|
-
* @param path - The path of the
|
|
318
|
-
* @returns `true` if the
|
|
374
|
+
* @param path - The path or id of the file.
|
|
375
|
+
* @returns `true` if the file exists, otherwise `false`.
|
|
319
376
|
*/
|
|
320
|
-
|
|
377
|
+
existsSync: (path: string) => boolean;
|
|
321
378
|
/**
|
|
322
|
-
* Checks if a file
|
|
379
|
+
* Checks if a file is virtual in the virtual file system (VFS).
|
|
323
380
|
*
|
|
324
|
-
* @param
|
|
325
|
-
* @returns `true` if the file
|
|
381
|
+
* @param path - The path or id of the file.
|
|
382
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
326
383
|
*/
|
|
327
|
-
|
|
384
|
+
isVirtual: (path: string) => boolean;
|
|
328
385
|
/**
|
|
329
386
|
* Gets the metadata of a file in the virtual file system (VFS).
|
|
330
387
|
*
|
|
331
|
-
* @param
|
|
388
|
+
* @param path - The path or id of the file.
|
|
332
389
|
* @returns The metadata of the file if it exists, otherwise undefined.
|
|
333
390
|
*/
|
|
334
|
-
getMetadata: (
|
|
335
|
-
/**
|
|
336
|
-
* Gets the stats of a file in the virtual file system (VFS).
|
|
337
|
-
*
|
|
338
|
-
* @param pathOrId - The path or id of the file.
|
|
339
|
-
* @param options - Optional parameters for getting the stats.
|
|
340
|
-
* @returns The stats of the file if it exists, otherwise undefined.
|
|
341
|
-
*/
|
|
342
|
-
lstat: (pathOrId: string, options?: StatSyncOptions & {
|
|
343
|
-
bigint?: false | undefined;
|
|
344
|
-
throwIfNoEntry: false;
|
|
345
|
-
}) => Promise<Stats>;
|
|
346
|
-
/**
|
|
347
|
-
* Gets the stats of a file in the virtual file system (VFS).
|
|
348
|
-
*
|
|
349
|
-
* @param pathOrId - The path or id of the file.
|
|
350
|
-
* @param options - Optional parameters for getting the stats.
|
|
351
|
-
* @returns The stats of the file if it exists, otherwise undefined.
|
|
352
|
-
*/
|
|
353
|
-
lstatSync: (pathOrId: string, options?: StatSyncOptions & {
|
|
354
|
-
bigint?: false | undefined;
|
|
355
|
-
throwIfNoEntry: false;
|
|
356
|
-
}) => Stats | undefined;
|
|
357
|
-
/**
|
|
358
|
-
* Gets the stats of a file in the virtual file system (VFS).
|
|
359
|
-
*
|
|
360
|
-
* @param pathOrId - The path or id of the file.
|
|
361
|
-
* @returns The stats of the file if it exists, otherwise false.
|
|
362
|
-
*/
|
|
363
|
-
stat: (pathOrId: string, options?: StatSyncOptions & {
|
|
364
|
-
bigint?: false | undefined;
|
|
365
|
-
throwIfNoEntry: false;
|
|
366
|
-
}) => Promise<Stats>;
|
|
367
|
-
/**
|
|
368
|
-
* Gets the stats of a file in the virtual file system (VFS).
|
|
369
|
-
*
|
|
370
|
-
* @param pathOrId - The path or id of the file.
|
|
371
|
-
* @returns The stats of the file if it exists, otherwise false.
|
|
372
|
-
*/
|
|
373
|
-
statSync: (pathOrId: string, options?: StatSyncOptions & {
|
|
374
|
-
bigint?: false | undefined;
|
|
375
|
-
throwIfNoEntry: false;
|
|
376
|
-
}) => Stats | undefined;
|
|
391
|
+
getMetadata: (path: string) => VirtualFileMetadata | undefined;
|
|
377
392
|
/**
|
|
378
393
|
* Lists files in a given path.
|
|
379
394
|
*
|
|
380
395
|
* @param path - The path to list files from.
|
|
381
|
-
* @param options - Options for listing files, such as encoding and recursion.
|
|
382
396
|
* @returns An array of file names in the specified path.
|
|
383
397
|
*/
|
|
384
|
-
|
|
385
|
-
encoding: BufferEncoding | null;
|
|
386
|
-
withFileTypes?: false | undefined;
|
|
387
|
-
recursive?: boolean | undefined;
|
|
388
|
-
} | BufferEncoding) => string[];
|
|
398
|
+
listSync: (path: string) => string[];
|
|
389
399
|
/**
|
|
390
400
|
* Lists files in a given path.
|
|
391
401
|
*
|
|
392
402
|
* @param path - The path to list files from.
|
|
393
|
-
* @param options - Options for listing files, such as encoding and recursion.
|
|
394
403
|
* @returns An array of file names in the specified path.
|
|
395
404
|
*/
|
|
396
|
-
|
|
397
|
-
encoding: BufferEncoding | null;
|
|
398
|
-
withFileTypes?: false | undefined;
|
|
399
|
-
recursive?: boolean | undefined;
|
|
400
|
-
} | BufferEncoding) => Promise<string[]>;
|
|
405
|
+
list: (path: string) => Promise<string[]>;
|
|
401
406
|
/**
|
|
402
407
|
* Removes a file or symbolic link in the virtual file system (VFS).
|
|
403
408
|
*
|
|
404
409
|
* @param path - The path to the file to remove.
|
|
405
410
|
* @returns A promise that resolves when the file is removed.
|
|
406
411
|
*/
|
|
407
|
-
|
|
412
|
+
removeSync: (path: string) => void;
|
|
408
413
|
/**
|
|
409
414
|
* Asynchronously removes a file or symbolic link in the virtual file system (VFS).
|
|
410
415
|
*
|
|
411
416
|
* @param path - The path to the file to remove.
|
|
412
417
|
* @returns A promise that resolves when the file is removed.
|
|
413
418
|
*/
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Removes a directory in the virtual file system (VFS).
|
|
417
|
-
*
|
|
418
|
-
* @param path - The path to create the directory at.
|
|
419
|
-
* @param options - Options for creating the directory.
|
|
420
|
-
*/
|
|
421
|
-
rmdirSync: (path: string, options?: RmDirOptions & ResolveFSOptions) => any;
|
|
422
|
-
/**
|
|
423
|
-
* Removes a directory in the virtual file system (VFS).
|
|
424
|
-
*
|
|
425
|
-
* @param path - The path to create the directory at.
|
|
426
|
-
* @param options - Options for creating the directory.
|
|
427
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
428
|
-
*/
|
|
429
|
-
rmdir: (path: string, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
|
|
430
|
-
/**
|
|
431
|
-
* Removes a file or directory in the virtual file system (VFS).
|
|
432
|
-
*
|
|
433
|
-
* @param path - The path to the file or directory to remove.
|
|
434
|
-
* @param options - Options for removing the file or directory.
|
|
435
|
-
* @returns A promise that resolves when the file or directory is removed.
|
|
436
|
-
*/
|
|
437
|
-
rm: (path: string, options?: RmOptions & ResolveFSOptions) => Promise<void>;
|
|
438
|
-
/**
|
|
439
|
-
* Synchronously removes a file or directory in the virtual file system (VFS).
|
|
440
|
-
*
|
|
441
|
-
* @param path - The path to the file or directory to remove.
|
|
442
|
-
* @param options - Options for removing the file or directory.
|
|
443
|
-
*/
|
|
444
|
-
rmSync: (path: string, options?: RmOptions & ResolveFSOptions) => void;
|
|
445
|
-
/**
|
|
446
|
-
* Creates a directory in the virtual file system (VFS).
|
|
447
|
-
*
|
|
448
|
-
* @param path - The path to create the directory at.
|
|
449
|
-
* @param options - Options for creating the directory.
|
|
450
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
451
|
-
*/
|
|
452
|
-
mkdirSync: (path: string, options?: MakeDirectoryOptions) => string | undefined;
|
|
453
|
-
/**
|
|
454
|
-
* Creates a directory in the virtual file system (VFS).
|
|
455
|
-
*
|
|
456
|
-
* @param path - The path to create the directory at.
|
|
457
|
-
* @param options - Options for creating the directory.
|
|
458
|
-
* @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
|
|
459
|
-
*/
|
|
460
|
-
mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
|
|
419
|
+
remove: (path: string) => Promise<void>;
|
|
461
420
|
/**
|
|
462
421
|
* Reads a file from the virtual file system (VFS).
|
|
463
422
|
*
|
|
464
|
-
* @param
|
|
423
|
+
* @param path - The path or id of the file.
|
|
465
424
|
* @returns The contents of the file if it exists, otherwise undefined.
|
|
466
425
|
*/
|
|
467
|
-
|
|
426
|
+
read: (path: string) => Promise<string | undefined>;
|
|
468
427
|
/**
|
|
469
428
|
* Reads a file from the virtual file system (VFS).
|
|
470
429
|
*
|
|
471
|
-
* @param
|
|
430
|
+
* @param path - The path or id of the file.
|
|
472
431
|
*/
|
|
473
|
-
|
|
432
|
+
readSync: (path: string) => string | undefined;
|
|
474
433
|
/**
|
|
475
434
|
* Writes a file to the virtual file system (VFS).
|
|
476
435
|
*
|
|
477
436
|
* @param path - The path to the file.
|
|
478
437
|
* @param data - The contents of the file.
|
|
479
|
-
* @param options -
|
|
438
|
+
* @param options - Options for writing the file.
|
|
480
439
|
* @returns A promise that resolves when the file is written.
|
|
481
440
|
*/
|
|
482
|
-
|
|
441
|
+
write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
|
|
483
442
|
/**
|
|
484
443
|
* Writes a file to the virtual file system (VFS).
|
|
485
444
|
*
|
|
486
445
|
* @param path - The path to the file.
|
|
487
446
|
* @param data - The contents of the file.
|
|
488
|
-
* @param options -
|
|
447
|
+
* @param options - Options for writing the file.
|
|
489
448
|
*/
|
|
490
|
-
|
|
449
|
+
writeSync: (path: string, data: string, options?: WriteOptions) => void;
|
|
491
450
|
/**
|
|
492
451
|
* Moves a file from one path to another in the virtual file system (VFS).
|
|
493
452
|
*
|
|
@@ -530,13 +489,6 @@ interface VirtualFileSystemInterface {
|
|
|
530
489
|
* @returns An array of file paths matching the provided pattern(s)
|
|
531
490
|
*/
|
|
532
491
|
globSync: (pattern: string | string[]) => string[];
|
|
533
|
-
/**
|
|
534
|
-
* Resolves a path or id to a file path in the virtual file system.
|
|
535
|
-
*
|
|
536
|
-
* @param pathOrId - The path or id of the file to resolve.
|
|
537
|
-
* @returns The resolved path of the file if it exists, otherwise false.
|
|
538
|
-
*/
|
|
539
|
-
realpathSync: (pathOrId: string) => string;
|
|
540
492
|
/**
|
|
541
493
|
* A helper function to resolve modules using the Jiti resolver
|
|
542
494
|
*
|
|
@@ -686,13 +638,16 @@ interface OutputConfig {
|
|
|
686
638
|
*
|
|
687
639
|
* @defaultValue "\{projectRoot\}/dist"
|
|
688
640
|
*/
|
|
689
|
-
|
|
641
|
+
buildPath?: string;
|
|
690
642
|
/**
|
|
691
|
-
* The
|
|
643
|
+
* The folder where the generated runtime artifacts will be located
|
|
692
644
|
*
|
|
693
|
-
* @
|
|
645
|
+
* @remarks
|
|
646
|
+
* This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
|
|
647
|
+
*
|
|
648
|
+
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
694
649
|
*/
|
|
695
|
-
|
|
650
|
+
artifactsPath?: string;
|
|
696
651
|
/**
|
|
697
652
|
* The path of the generated runtime declaration file relative to the workspace root.
|
|
698
653
|
*
|
|
@@ -708,15 +663,6 @@ interface OutputConfig {
|
|
|
708
663
|
* @defaultValue "powerlines"
|
|
709
664
|
*/
|
|
710
665
|
builtinPrefix?: string;
|
|
711
|
-
/**
|
|
712
|
-
* The folder where the generated runtime artifacts will be located
|
|
713
|
-
*
|
|
714
|
-
* @remarks
|
|
715
|
-
* This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
|
|
716
|
-
*
|
|
717
|
-
* @defaultValue "\{projectRoot\}/.powerlines"
|
|
718
|
-
*/
|
|
719
|
-
artifactsFolder?: string;
|
|
720
666
|
/**
|
|
721
667
|
* The module format of the output files
|
|
722
668
|
*
|
|
@@ -733,42 +679,21 @@ interface OutputConfig {
|
|
|
733
679
|
* 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.
|
|
734
680
|
*/
|
|
735
681
|
assets?: Array<string | AssetGlob>;
|
|
736
|
-
}
|
|
737
|
-
interface BaseConfig {
|
|
738
|
-
/**
|
|
739
|
-
* The name of the project
|
|
740
|
-
*/
|
|
741
|
-
name?: string;
|
|
742
|
-
/**
|
|
743
|
-
* The project display title
|
|
744
|
-
*
|
|
745
|
-
* @remarks
|
|
746
|
-
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
747
|
-
*/
|
|
748
|
-
title?: string;
|
|
749
682
|
/**
|
|
750
|
-
* A
|
|
683
|
+
* A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
|
|
751
684
|
*
|
|
752
685
|
* @remarks
|
|
753
|
-
* If
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
/**
|
|
757
|
-
* The log level to use for the Powerlines processes.
|
|
686
|
+
* If a string preset is provided, it must be one of the following values:
|
|
687
|
+
* - `"virtual"`: Uses the local file system for storage.
|
|
688
|
+
* - `"fs"`: Uses an in-memory virtual file system for storage.
|
|
758
689
|
*
|
|
759
|
-
* @
|
|
760
|
-
*/
|
|
761
|
-
logLevel?: LogLevelLabel | null;
|
|
762
|
-
/**
|
|
763
|
-
* A custom logger function to use for logging messages
|
|
764
|
-
*/
|
|
765
|
-
customLogger?: LogFn;
|
|
766
|
-
/**
|
|
767
|
-
* 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.
|
|
690
|
+
* If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
|
|
768
691
|
*
|
|
769
|
-
* @defaultValue "
|
|
692
|
+
* @defaultValue "virtual"
|
|
770
693
|
*/
|
|
771
|
-
|
|
694
|
+
storage?: StoragePort | StoragePreset;
|
|
695
|
+
}
|
|
696
|
+
interface BaseConfig {
|
|
772
697
|
/**
|
|
773
698
|
* The entry point(s) for the application
|
|
774
699
|
*/
|
|
@@ -852,6 +777,40 @@ interface EnvironmentConfig extends BaseConfig {
|
|
|
852
777
|
consumer?: "client" | "server";
|
|
853
778
|
}
|
|
854
779
|
interface CommonUserConfig extends BaseConfig {
|
|
780
|
+
/**
|
|
781
|
+
* The name of the project
|
|
782
|
+
*/
|
|
783
|
+
name?: string;
|
|
784
|
+
/**
|
|
785
|
+
* The project display title
|
|
786
|
+
*
|
|
787
|
+
* @remarks
|
|
788
|
+
* This option is used in documentation generation and other places where a human-readable title is needed.
|
|
789
|
+
*/
|
|
790
|
+
title?: string;
|
|
791
|
+
/**
|
|
792
|
+
* A description of the project
|
|
793
|
+
*
|
|
794
|
+
* @remarks
|
|
795
|
+
* If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
|
|
796
|
+
*/
|
|
797
|
+
description?: string;
|
|
798
|
+
/**
|
|
799
|
+
* The log level to use for the Powerlines processes.
|
|
800
|
+
*
|
|
801
|
+
* @defaultValue "info"
|
|
802
|
+
*/
|
|
803
|
+
logLevel?: LogLevelLabel | null;
|
|
804
|
+
/**
|
|
805
|
+
* A custom logger function to use for logging messages
|
|
806
|
+
*/
|
|
807
|
+
customLogger?: LogFn;
|
|
808
|
+
/**
|
|
809
|
+
* 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.
|
|
810
|
+
*
|
|
811
|
+
* @defaultValue "production"
|
|
812
|
+
*/
|
|
813
|
+
mode?: "development" | "test" | "production";
|
|
855
814
|
/**
|
|
856
815
|
* The type of project being built
|
|
857
816
|
*
|
|
@@ -902,7 +861,7 @@ interface CommonUserConfig extends BaseConfig {
|
|
|
902
861
|
* A string identifier that allows a child framework or tool to identify itself when using Powerlines.
|
|
903
862
|
*
|
|
904
863
|
* @remarks
|
|
905
|
-
* If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.
|
|
864
|
+
* 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.
|
|
906
865
|
*
|
|
907
866
|
* @defaultValue "powerlines"
|
|
908
867
|
*/
|
|
@@ -950,7 +909,7 @@ interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
|
950
909
|
*/
|
|
951
910
|
output?: string;
|
|
952
911
|
}
|
|
953
|
-
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "
|
|
912
|
+
type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
|
|
954
913
|
/**
|
|
955
914
|
* The name of the environment
|
|
956
915
|
*/
|
|
@@ -961,9 +920,9 @@ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "mode" | "
|
|
|
961
920
|
preview?: ResolvedPreviewOptions;
|
|
962
921
|
};
|
|
963
922
|
type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
|
|
964
|
-
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets"> & {
|
|
923
|
+
type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
|
|
965
924
|
assets: ResolvedAssetGlob[];
|
|
966
|
-
}>;
|
|
925
|
+
}> & Pick<OutputConfig, "storage">;
|
|
967
926
|
/**
|
|
968
927
|
* The resolved options for the Powerlines project configuration.
|
|
969
928
|
*/
|
|
@@ -1231,17 +1190,15 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
1231
1190
|
* @param code - The source code of the builtin file
|
|
1232
1191
|
* @param id - The unique identifier of the builtin file
|
|
1233
1192
|
* @param path - An optional path to write the builtin file to
|
|
1234
|
-
* @param options - Options for writing the file
|
|
1235
1193
|
*/
|
|
1236
|
-
emitBuiltin: (code: string, id: string, path?: string
|
|
1194
|
+
emitBuiltin: (code: string, id: string, path?: string) => Promise<void>;
|
|
1237
1195
|
/**
|
|
1238
1196
|
* Resolves a entry virtual file and writes it to the VFS if it does not already exist
|
|
1239
1197
|
*
|
|
1240
1198
|
* @param code - The source code of the entry file
|
|
1241
1199
|
* @param path - An optional path to write the entry file to
|
|
1242
|
-
* @param options - Options for writing the file
|
|
1243
1200
|
*/
|
|
1244
|
-
emitEntry: (code: string, path: string
|
|
1201
|
+
emitEntry: (code: string, path: string) => Promise<void>;
|
|
1245
1202
|
/**
|
|
1246
1203
|
* A function to update the context fields using a new user configuration options
|
|
1247
1204
|
*/
|