@powerlines/plugin-crypto 0.10.1 → 0.10.3

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.
@@ -1,4 +1,4 @@
1
- import { a as CryptoPluginContext } from '../index-sWc0GdCe.cjs';
1
+ import { a as CryptoPluginContext } from '../index-CKLwxWIp.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- import { a as CryptoPluginContext } from '../index-sWc0GdCe.js';
1
+ import { a as CryptoPluginContext } from '../index-CKLwxWIp.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,5 +1,5 @@
1
1
  export { cryptoModule } from './crypto.cjs';
2
- import '../index-sWc0GdCe.cjs';
2
+ import '../index-CKLwxWIp.cjs';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -15,8 +15,11 @@ import '@babel/helper-plugin-utils';
15
15
  import '@stryke/env/get-env-paths';
16
16
  import '@stryke/types/package-json';
17
17
  import 'jiti';
18
+ import 'magic-string';
18
19
  import 'semver';
20
+ import 'ts-morph';
19
21
  import 'unplugin';
22
+ import '@stryke/fs/resolve';
20
23
  import 'node:fs';
21
24
  import '@stryke/types/tsconfig';
22
25
  import 'typescript';
@@ -1,5 +1,5 @@
1
1
  export { cryptoModule } from './crypto.js';
2
- import '../index-sWc0GdCe.js';
2
+ import '../index-CKLwxWIp.js';
3
3
  import '@alloy-js/core/jsx-runtime';
4
4
  import '@deepkit/type';
5
5
  import '@stryke/capnp';
@@ -15,8 +15,11 @@ import '@babel/helper-plugin-utils';
15
15
  import '@stryke/env/get-env-paths';
16
16
  import '@stryke/types/package-json';
17
17
  import 'jiti';
18
+ import 'magic-string';
18
19
  import 'semver';
20
+ import 'ts-morph';
19
21
  import 'unplugin';
22
+ import '@stryke/fs/resolve';
20
23
  import 'node:fs';
21
24
  import '@stryke/types/tsconfig';
22
25
  import 'typescript';
@@ -13,9 +13,12 @@ import { BabelAPI } from '@babel/helper-plugin-utils';
13
13
  import { EnvPaths } from '@stryke/env/get-env-paths';
14
14
  import { PackageJson } from '@stryke/types/package-json';
15
15
  import { Jiti } from 'jiti';
16
+ import { SourceMap } from 'magic-string';
16
17
  import { Range } from 'semver';
17
- import { UnpluginContext, UnpluginMessage, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
18
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
18
+ import { Project } from 'ts-morph';
19
+ import { UnpluginContext, UnpluginMessage, ExternalIdResult, UnpluginBuildContext, TransformResult as TransformResult$1, HookFilter, UnpluginOptions } from 'unplugin';
20
+ import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
21
+ import { StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
19
22
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
23
  import ts from 'typescript';
21
24
  import { ArrayValues } from '@stryke/types/array';
@@ -262,21 +265,27 @@ interface PowerlinesWriteFileOptions extends ResolveFSOptions {
262
265
  type NodeWriteFileOptions = WriteFileOptions$1;
263
266
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
264
267
  type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
265
- interface ResolvePathOptions extends ResolveFSOptions {
268
+ interface ResolveOptions extends ResolveOptions$1 {
266
269
  /**
267
- * Should the resolved path include the file extension?
268
- *
269
- * @defaultValue true
270
+ * If true, the module is being resolved as an entry point.
271
+ */
272
+ isEntry?: boolean;
273
+ /**
274
+ * If true, the resolver will skip using the cache when resolving modules.
275
+ */
276
+ skipCache?: boolean;
277
+ /**
278
+ * An array of external modules or patterns to exclude from resolution.
270
279
  */
271
- withExtension?: boolean;
280
+ external?: (string | RegExp)[];
272
281
  /**
273
- * The paths to search for the file.
282
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
274
283
  */
275
- paths?: string[];
284
+ noExternal?: (string | RegExp)[];
276
285
  /**
277
- * The type of the path to resolve.
286
+ * An array of patterns to match when resolving modules.
278
287
  */
279
- pathType?: "file" | "directory";
288
+ skipNodeModulesBundle?: boolean;
280
289
  }
281
290
  interface VirtualFileSystemInterface {
282
291
  /**
@@ -290,27 +299,33 @@ interface VirtualFileSystemInterface {
290
299
  /**
291
300
  * The underlying file metadata.
292
301
  */
293
- metadata: Record<string, VirtualFileMetadata | undefined>;
302
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
303
+ /**
304
+ * A map of file paths to their module ids.
305
+ */
306
+ ids: Readonly<Record<string, string>>;
294
307
  /**
295
308
  * A map of module ids to their file paths.
296
309
  */
297
- ids: Record<string, string>;
310
+ paths: Readonly<Record<string, string>>;
298
311
  /**
299
312
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
300
313
  *
301
314
  * @param pathOrId - The path or id to check.
315
+ * @param importer - The importer path, if any.
302
316
  * @param options - Optional parameters for resolving the path.
303
317
  * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
304
318
  */
305
- isVirtual: (pathOrId: string, options?: ResolvePathOptions) => boolean;
319
+ isVirtual: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
306
320
  /**
307
321
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
308
322
  *
309
323
  * @param pathOrId - The path or id to check.
324
+ * @param importer - The importer path, if any.
310
325
  * @param options - Optional parameters for resolving the path.
311
326
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
312
327
  */
313
- isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
328
+ isPhysical: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
314
329
  /**
315
330
  * Checks if a file exists in the virtual file system (VFS).
316
331
  *
@@ -338,7 +353,7 @@ interface VirtualFileSystemInterface {
338
353
  * @param pathOrId - The path or id of the file.
339
354
  * @returns The metadata of the file if it exists, otherwise undefined.
340
355
  */
341
- getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
356
+ getMetadata: (pathOrId: string) => VirtualFileMetadata | undefined;
342
357
  /**
343
358
  * Gets the stats of a file in the virtual file system (VFS).
344
359
  *
@@ -411,7 +426,7 @@ interface VirtualFileSystemInterface {
411
426
  * @param path - The path to the file to remove.
412
427
  * @returns A promise that resolves when the file is removed.
413
428
  */
414
- unlinkSync: (path: PathLike, options?: ResolveFSOptions) => void;
429
+ unlinkSync: (path: string, options?: ResolveFSOptions) => void;
415
430
  /**
416
431
  * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
417
432
  *
@@ -425,7 +440,7 @@ interface VirtualFileSystemInterface {
425
440
  * @param path - The path to create the directory at.
426
441
  * @param options - Options for creating the directory.
427
442
  */
428
- rmdirSync: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => any;
443
+ rmdirSync: (path: string, options?: RmDirOptions & ResolveFSOptions) => any;
429
444
  /**
430
445
  * Removes a directory in the virtual file system (VFS).
431
446
  *
@@ -433,7 +448,7 @@ interface VirtualFileSystemInterface {
433
448
  * @param options - Options for creating the directory.
434
449
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
435
450
  */
436
- rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
451
+ rmdir: (path: string, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
437
452
  /**
438
453
  * Removes a file or directory in the virtual file system (VFS).
439
454
  *
@@ -441,14 +456,14 @@ interface VirtualFileSystemInterface {
441
456
  * @param options - Options for removing the file or directory.
442
457
  * @returns A promise that resolves when the file or directory is removed.
443
458
  */
444
- rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
459
+ rm: (path: string, options?: RmOptions & ResolveFSOptions) => Promise<void>;
445
460
  /**
446
461
  * Synchronously removes a file or directory in the virtual file system (VFS).
447
462
  *
448
463
  * @param path - The path to the file or directory to remove.
449
464
  * @param options - Options for removing the file or directory.
450
465
  */
451
- rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
466
+ rmSync: (path: string, options?: RmOptions & ResolveFSOptions) => void;
452
467
  /**
453
468
  * Creates a directory in the virtual file system (VFS).
454
469
  *
@@ -456,7 +471,7 @@ interface VirtualFileSystemInterface {
456
471
  * @param options - Options for creating the directory.
457
472
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
458
473
  */
459
- mkdirSync: (path: PathLike, options?: MakeDirectoryOptions) => string | undefined;
474
+ mkdirSync: (path: string, options?: MakeDirectoryOptions) => string | undefined;
460
475
  /**
461
476
  * Creates a directory in the virtual file system (VFS).
462
477
  *
@@ -464,7 +479,7 @@ interface VirtualFileSystemInterface {
464
479
  * @param options - Options for creating the directory.
465
480
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
466
481
  */
467
- mkdir: (path: PathLike, options?: MakeDirectoryOptions) => Promise<string | undefined>;
482
+ mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
468
483
  /**
469
484
  * Reads a file from the virtual file system (VFS).
470
485
  *
@@ -486,7 +501,7 @@ interface VirtualFileSystemInterface {
486
501
  * @param options - Optional parameters for writing the file.
487
502
  * @returns A promise that resolves when the file is written.
488
503
  */
489
- writeFile: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
504
+ writeFile: (path: string, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
490
505
  /**
491
506
  * Writes a file to the virtual file system (VFS).
492
507
  *
@@ -494,7 +509,7 @@ interface VirtualFileSystemInterface {
494
509
  * @param data - The contents of the file.
495
510
  * @param options - Optional parameters for writing the file.
496
511
  */
497
- writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
512
+ writeFileSync: (path: string, data?: WriteFileData, options?: WriteFileOptions) => void;
498
513
  /**
499
514
  * Moves a file from one path to another in the virtual file system (VFS).
500
515
  *
@@ -541,24 +556,43 @@ interface VirtualFileSystemInterface {
541
556
  * Resolves a path or id to a file path in the virtual file system.
542
557
  *
543
558
  * @param pathOrId - The path or id of the file to resolve.
544
- * @param options - Optional parameters for resolving the path.
545
559
  * @returns The resolved path of the file if it exists, otherwise false.
546
560
  */
547
- resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
561
+ realpathSync: (pathOrId: string) => string;
548
562
  /**
549
- * Formats a path to match the virtual file system (VFS) structure.
563
+ * A helper function to resolve modules using the Jiti resolver
550
564
  *
551
- * @param path - The path to format.
552
- * @returns The formatted path.
565
+ * @remarks
566
+ * This function can be used to resolve modules relative to the project root directory.
567
+ *
568
+ * @example
569
+ * ```ts
570
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
571
+ * ```
572
+ *
573
+ * @param id - The module to resolve.
574
+ * @param importer - An optional path to the importer module.
575
+ * @param options - Additional resolution options.
576
+ * @returns A promise that resolves to the resolved module path.
553
577
  */
554
- formatPath: (path: string) => string;
578
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<string | undefined>;
555
579
  /**
556
- * Resolves a path or id to a file path in the virtual file system.
580
+ * A synchronous helper function to resolve modules using the Jiti resolver
557
581
  *
558
- * @param pathOrId - The path or id of the file to resolve.
559
- * @returns The resolved path of the file if it exists, otherwise false.
582
+ * @remarks
583
+ * This function can be used to resolve modules relative to the project root directory.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
588
+ * ```
589
+ *
590
+ * @param id - The module to resolve.
591
+ * @param importer - An optional path to the importer module.
592
+ * @param options - Additional resolution options.
593
+ * @returns The resolved module path.
560
594
  */
561
- realpathSync: (pathOrId: string) => string;
595
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions) => string | undefined;
562
596
  /**
563
597
  * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
564
598
  */
@@ -1052,6 +1086,10 @@ interface MetaInfo {
1052
1086
  interface Resolver extends Jiti {
1053
1087
  plugin: Jiti;
1054
1088
  }
1089
+ interface TransformResult {
1090
+ code: string;
1091
+ map: SourceMap | null;
1092
+ }
1055
1093
  interface InitContextOptions {
1056
1094
  /**
1057
1095
  * If false, the plugin will be loaded after all other plugins.
@@ -1186,6 +1224,47 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1186
1224
  * The builtin module id that exist in the Powerlines virtual file system
1187
1225
  */
1188
1226
  builtins: string[];
1227
+ /**
1228
+ * The {@link Project} instance used for type reflection and module manipulation
1229
+ *
1230
+ * @see https://ts-morph.com/
1231
+ *
1232
+ * @remarks
1233
+ * This instance is created lazily on first access.
1234
+ */
1235
+ program: Project;
1236
+ /**
1237
+ * A helper function to resolve modules using the Jiti resolver
1238
+ *
1239
+ * @remarks
1240
+ * This function can be used to resolve modules relative to the project root directory.
1241
+ *
1242
+ * @example
1243
+ * ```ts
1244
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1245
+ * ```
1246
+ *
1247
+ * @param id - The module to resolve.
1248
+ * @param importer - An optional path to the importer module.
1249
+ * @param options - Additional resolution options.
1250
+ * @returns A promise that resolves to the resolved module path.
1251
+ */
1252
+ resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1253
+ /**
1254
+ * A helper function to load modules using the Jiti resolver
1255
+ *
1256
+ * @remarks
1257
+ * This function can be used to load modules relative to the project root directory.
1258
+ *
1259
+ * @example
1260
+ * ```ts
1261
+ * const module = await context.load("some-module", "/path/to/importer");
1262
+ * ```
1263
+ *
1264
+ * @param id - The module to load.
1265
+ * @returns A promise that resolves to the loaded module.
1266
+ */
1267
+ load: (id: string) => Promise<TransformResult | undefined>;
1189
1268
  /**
1190
1269
  * The Powerlines builtin virtual files
1191
1270
  */
@@ -1355,7 +1434,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1355
1434
  * @param id - The identifier of the source code.
1356
1435
  * @returns A promise that resolves when the hook is complete.
1357
1436
  */
1358
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
1437
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>;
1359
1438
  /**
1360
1439
  * A hook that is called to load the source code.
1361
1440
  *
@@ -1363,7 +1442,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1363
1442
  * @param id - The identifier of the source code.
1364
1443
  * @returns A promise that resolves when the hook is complete.
1365
1444
  */
1366
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
1445
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>;
1367
1446
  /**
1368
1447
  * A hook that is called to resolve the identifier of the source code.
1369
1448
  *
@@ -1413,7 +1492,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1413
1492
  * @param id - The identifier of the source code.
1414
1493
  * @returns A promise that resolves when the hook is complete.
1415
1494
  */
1416
- transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
1495
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>, "code" | "id">;
1417
1496
  /**
1418
1497
  * A hook that is called to load the source code.
1419
1498
  *
@@ -1421,7 +1500,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1421
1500
  * @param id - The identifier of the source code.
1422
1501
  * @returns A promise that resolves when the hook is complete.
1423
1502
  */
1424
- load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
1503
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>, "id">;
1425
1504
  /**
1426
1505
  * A hook that is called to resolve the identifier of the source code.
1427
1506
  *
@@ -13,9 +13,12 @@ import { BabelAPI } from '@babel/helper-plugin-utils';
13
13
  import { EnvPaths } from '@stryke/env/get-env-paths';
14
14
  import { PackageJson } from '@stryke/types/package-json';
15
15
  import { Jiti } from 'jiti';
16
+ import { SourceMap } from 'magic-string';
16
17
  import { Range } from 'semver';
17
- import { UnpluginContext, UnpluginMessage, UnpluginBuildContext, TransformResult, ExternalIdResult, HookFilter, UnpluginOptions } from 'unplugin';
18
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
18
+ import { Project } from 'ts-morph';
19
+ import { UnpluginContext, UnpluginMessage, ExternalIdResult, UnpluginBuildContext, TransformResult as TransformResult$1, HookFilter, UnpluginOptions } from 'unplugin';
20
+ import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
21
+ import { StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
19
22
  import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig';
20
23
  import ts from 'typescript';
21
24
  import { ArrayValues } from '@stryke/types/array';
@@ -262,21 +265,27 @@ interface PowerlinesWriteFileOptions extends ResolveFSOptions {
262
265
  type NodeWriteFileOptions = WriteFileOptions$1;
263
266
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
264
267
  type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
265
- interface ResolvePathOptions extends ResolveFSOptions {
268
+ interface ResolveOptions extends ResolveOptions$1 {
266
269
  /**
267
- * Should the resolved path include the file extension?
268
- *
269
- * @defaultValue true
270
+ * If true, the module is being resolved as an entry point.
271
+ */
272
+ isEntry?: boolean;
273
+ /**
274
+ * If true, the resolver will skip using the cache when resolving modules.
275
+ */
276
+ skipCache?: boolean;
277
+ /**
278
+ * An array of external modules or patterns to exclude from resolution.
270
279
  */
271
- withExtension?: boolean;
280
+ external?: (string | RegExp)[];
272
281
  /**
273
- * The paths to search for the file.
282
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
274
283
  */
275
- paths?: string[];
284
+ noExternal?: (string | RegExp)[];
276
285
  /**
277
- * The type of the path to resolve.
286
+ * An array of patterns to match when resolving modules.
278
287
  */
279
- pathType?: "file" | "directory";
288
+ skipNodeModulesBundle?: boolean;
280
289
  }
281
290
  interface VirtualFileSystemInterface {
282
291
  /**
@@ -290,27 +299,33 @@ interface VirtualFileSystemInterface {
290
299
  /**
291
300
  * The underlying file metadata.
292
301
  */
293
- metadata: Record<string, VirtualFileMetadata | undefined>;
302
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
303
+ /**
304
+ * A map of file paths to their module ids.
305
+ */
306
+ ids: Readonly<Record<string, string>>;
294
307
  /**
295
308
  * A map of module ids to their file paths.
296
309
  */
297
- ids: Record<string, string>;
310
+ paths: Readonly<Record<string, string>>;
298
311
  /**
299
312
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
300
313
  *
301
314
  * @param pathOrId - The path or id to check.
315
+ * @param importer - The importer path, if any.
302
316
  * @param options - Optional parameters for resolving the path.
303
317
  * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
304
318
  */
305
- isVirtual: (pathOrId: string, options?: ResolvePathOptions) => boolean;
319
+ isVirtual: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
306
320
  /**
307
321
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
308
322
  *
309
323
  * @param pathOrId - The path or id to check.
324
+ * @param importer - The importer path, if any.
310
325
  * @param options - Optional parameters for resolving the path.
311
326
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
312
327
  */
313
- isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
328
+ isPhysical: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
314
329
  /**
315
330
  * Checks if a file exists in the virtual file system (VFS).
316
331
  *
@@ -338,7 +353,7 @@ interface VirtualFileSystemInterface {
338
353
  * @param pathOrId - The path or id of the file.
339
354
  * @returns The metadata of the file if it exists, otherwise undefined.
340
355
  */
341
- getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
356
+ getMetadata: (pathOrId: string) => VirtualFileMetadata | undefined;
342
357
  /**
343
358
  * Gets the stats of a file in the virtual file system (VFS).
344
359
  *
@@ -411,7 +426,7 @@ interface VirtualFileSystemInterface {
411
426
  * @param path - The path to the file to remove.
412
427
  * @returns A promise that resolves when the file is removed.
413
428
  */
414
- unlinkSync: (path: PathLike, options?: ResolveFSOptions) => void;
429
+ unlinkSync: (path: string, options?: ResolveFSOptions) => void;
415
430
  /**
416
431
  * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
417
432
  *
@@ -425,7 +440,7 @@ interface VirtualFileSystemInterface {
425
440
  * @param path - The path to create the directory at.
426
441
  * @param options - Options for creating the directory.
427
442
  */
428
- rmdirSync: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => any;
443
+ rmdirSync: (path: string, options?: RmDirOptions & ResolveFSOptions) => any;
429
444
  /**
430
445
  * Removes a directory in the virtual file system (VFS).
431
446
  *
@@ -433,7 +448,7 @@ interface VirtualFileSystemInterface {
433
448
  * @param options - Options for creating the directory.
434
449
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
435
450
  */
436
- rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
451
+ rmdir: (path: string, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
437
452
  /**
438
453
  * Removes a file or directory in the virtual file system (VFS).
439
454
  *
@@ -441,14 +456,14 @@ interface VirtualFileSystemInterface {
441
456
  * @param options - Options for removing the file or directory.
442
457
  * @returns A promise that resolves when the file or directory is removed.
443
458
  */
444
- rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
459
+ rm: (path: string, options?: RmOptions & ResolveFSOptions) => Promise<void>;
445
460
  /**
446
461
  * Synchronously removes a file or directory in the virtual file system (VFS).
447
462
  *
448
463
  * @param path - The path to the file or directory to remove.
449
464
  * @param options - Options for removing the file or directory.
450
465
  */
451
- rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
466
+ rmSync: (path: string, options?: RmOptions & ResolveFSOptions) => void;
452
467
  /**
453
468
  * Creates a directory in the virtual file system (VFS).
454
469
  *
@@ -456,7 +471,7 @@ interface VirtualFileSystemInterface {
456
471
  * @param options - Options for creating the directory.
457
472
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
458
473
  */
459
- mkdirSync: (path: PathLike, options?: MakeDirectoryOptions) => string | undefined;
474
+ mkdirSync: (path: string, options?: MakeDirectoryOptions) => string | undefined;
460
475
  /**
461
476
  * Creates a directory in the virtual file system (VFS).
462
477
  *
@@ -464,7 +479,7 @@ interface VirtualFileSystemInterface {
464
479
  * @param options - Options for creating the directory.
465
480
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
466
481
  */
467
- mkdir: (path: PathLike, options?: MakeDirectoryOptions) => Promise<string | undefined>;
482
+ mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
468
483
  /**
469
484
  * Reads a file from the virtual file system (VFS).
470
485
  *
@@ -486,7 +501,7 @@ interface VirtualFileSystemInterface {
486
501
  * @param options - Optional parameters for writing the file.
487
502
  * @returns A promise that resolves when the file is written.
488
503
  */
489
- writeFile: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
504
+ writeFile: (path: string, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
490
505
  /**
491
506
  * Writes a file to the virtual file system (VFS).
492
507
  *
@@ -494,7 +509,7 @@ interface VirtualFileSystemInterface {
494
509
  * @param data - The contents of the file.
495
510
  * @param options - Optional parameters for writing the file.
496
511
  */
497
- writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
512
+ writeFileSync: (path: string, data?: WriteFileData, options?: WriteFileOptions) => void;
498
513
  /**
499
514
  * Moves a file from one path to another in the virtual file system (VFS).
500
515
  *
@@ -541,24 +556,43 @@ interface VirtualFileSystemInterface {
541
556
  * Resolves a path or id to a file path in the virtual file system.
542
557
  *
543
558
  * @param pathOrId - The path or id of the file to resolve.
544
- * @param options - Optional parameters for resolving the path.
545
559
  * @returns The resolved path of the file if it exists, otherwise false.
546
560
  */
547
- resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
561
+ realpathSync: (pathOrId: string) => string;
548
562
  /**
549
- * Formats a path to match the virtual file system (VFS) structure.
563
+ * A helper function to resolve modules using the Jiti resolver
550
564
  *
551
- * @param path - The path to format.
552
- * @returns The formatted path.
565
+ * @remarks
566
+ * This function can be used to resolve modules relative to the project root directory.
567
+ *
568
+ * @example
569
+ * ```ts
570
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
571
+ * ```
572
+ *
573
+ * @param id - The module to resolve.
574
+ * @param importer - An optional path to the importer module.
575
+ * @param options - Additional resolution options.
576
+ * @returns A promise that resolves to the resolved module path.
553
577
  */
554
- formatPath: (path: string) => string;
578
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<string | undefined>;
555
579
  /**
556
- * Resolves a path or id to a file path in the virtual file system.
580
+ * A synchronous helper function to resolve modules using the Jiti resolver
557
581
  *
558
- * @param pathOrId - The path or id of the file to resolve.
559
- * @returns The resolved path of the file if it exists, otherwise false.
582
+ * @remarks
583
+ * This function can be used to resolve modules relative to the project root directory.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
588
+ * ```
589
+ *
590
+ * @param id - The module to resolve.
591
+ * @param importer - An optional path to the importer module.
592
+ * @param options - Additional resolution options.
593
+ * @returns The resolved module path.
560
594
  */
561
- realpathSync: (pathOrId: string) => string;
595
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions) => string | undefined;
562
596
  /**
563
597
  * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
564
598
  */
@@ -1052,6 +1086,10 @@ interface MetaInfo {
1052
1086
  interface Resolver extends Jiti {
1053
1087
  plugin: Jiti;
1054
1088
  }
1089
+ interface TransformResult {
1090
+ code: string;
1091
+ map: SourceMap | null;
1092
+ }
1055
1093
  interface InitContextOptions {
1056
1094
  /**
1057
1095
  * If false, the plugin will be loaded after all other plugins.
@@ -1186,6 +1224,47 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
1186
1224
  * The builtin module id that exist in the Powerlines virtual file system
1187
1225
  */
1188
1226
  builtins: string[];
1227
+ /**
1228
+ * The {@link Project} instance used for type reflection and module manipulation
1229
+ *
1230
+ * @see https://ts-morph.com/
1231
+ *
1232
+ * @remarks
1233
+ * This instance is created lazily on first access.
1234
+ */
1235
+ program: Project;
1236
+ /**
1237
+ * A helper function to resolve modules using the Jiti resolver
1238
+ *
1239
+ * @remarks
1240
+ * This function can be used to resolve modules relative to the project root directory.
1241
+ *
1242
+ * @example
1243
+ * ```ts
1244
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1245
+ * ```
1246
+ *
1247
+ * @param id - The module to resolve.
1248
+ * @param importer - An optional path to the importer module.
1249
+ * @param options - Additional resolution options.
1250
+ * @returns A promise that resolves to the resolved module path.
1251
+ */
1252
+ resolveId: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
1253
+ /**
1254
+ * A helper function to load modules using the Jiti resolver
1255
+ *
1256
+ * @remarks
1257
+ * This function can be used to load modules relative to the project root directory.
1258
+ *
1259
+ * @example
1260
+ * ```ts
1261
+ * const module = await context.load("some-module", "/path/to/importer");
1262
+ * ```
1263
+ *
1264
+ * @param id - The module to load.
1265
+ * @returns A promise that resolves to the loaded module.
1266
+ */
1267
+ load: (id: string) => Promise<TransformResult | undefined>;
1189
1268
  /**
1190
1269
  * The Powerlines builtin virtual files
1191
1270
  */
@@ -1355,7 +1434,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1355
1434
  * @param id - The identifier of the source code.
1356
1435
  * @returns A promise that resolves when the hook is complete.
1357
1436
  */
1358
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
1437
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>;
1359
1438
  /**
1360
1439
  * A hook that is called to load the source code.
1361
1440
  *
@@ -1363,7 +1442,7 @@ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext
1363
1442
  * @param id - The identifier of the source code.
1364
1443
  * @returns A promise that resolves when the hook is complete.
1365
1444
  */
1366
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
1445
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>;
1367
1446
  /**
1368
1447
  * A hook that is called to resolve the identifier of the source code.
1369
1448
  *
@@ -1413,7 +1492,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1413
1492
  * @param id - The identifier of the source code.
1414
1493
  * @returns A promise that resolves when the hook is complete.
1415
1494
  */
1416
- transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
1495
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult$1>, "code" | "id">;
1417
1496
  /**
1418
1497
  * A hook that is called to load the source code.
1419
1498
  *
@@ -1421,7 +1500,7 @@ type PluginHooks<TContext extends PluginContext = PluginContext> = {
1421
1500
  * @param id - The identifier of the source code.
1422
1501
  * @returns A promise that resolves when the hook is complete.
1423
1502
  */
1424
- load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
1503
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult$1>, "id">;
1425
1504
  /**
1426
1505
  * A hook that is called to resolve the identifier of the source code.
1427
1506
  *
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),utils_js=require('@noble/ciphers/utils.js'),n=require('@powerlines/plugin-env'),types$1=require('@storm-software/config-tools/types'),crypto=require('./components/crypto'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var n__default=/*#__PURE__*/_interopDefault(n);/*****************************************
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkFBBMZ4NC_cjs=require('./chunk-FBBMZ4NC.cjs'),utils_js=require('@noble/ciphers/utils.js'),n=require('@powerlines/plugin-env'),types$1=require('@storm-software/config-tools/types'),p=require('defu'),crypto=require('./components/crypto'),components=require('./components'),types=require('./types');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var n__default=/*#__PURE__*/_interopDefault(n);var p__default=/*#__PURE__*/_interopDefault(p);/*****************************************
2
2
  *
3
3
  * ⚡ Built by Storm Software
4
4
  *
5
5
  *****************************************/
6
6
 
7
- function l(e={}){return {name:"crypto",dependsOn:[n__default.default(e.env)],config(){return {crypto:{salt:e.salt,encryptionKey:e.encryptionKey}}},configResolved(){this.dependencies["@noble/ciphers"]="^2.0.1",this.dependencies["@noble/hashes"]="^2.0.1",this.config.crypto.salt??=this.env.parsed.SALT,this.config.crypto.salt||(this.log(types$1.LogLevelLabel.WARN,"No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the `salt` plugin option or the `SALT` environment variable."),this.config.crypto.salt=utils_js.bytesToHex(utils_js.randomBytes(12))),this.config.crypto.encryptionKey??=this.env.parsed.ENCRYPTION_KEY,this.config.crypto.encryptionKey||(this.log(types$1.LogLevelLabel.WARN,"No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the `encryptionKey` plugin option or the `ENCRYPTION_KEY` environment variable."),this.config.crypto.encryptionKey=utils_js.bytesToHex(utils_js.randomBytes(32)));},async prepare(){this.log(types$1.LogLevelLabel.TRACE,"Preparing the Crypto runtime artifacts for the Powerlines project."),await this.emitBuiltin(await Promise.resolve(crypto.cryptoModule(this)),"crypto","crypto.ts");}}}chunkFBBMZ4NC_cjs.a(l,"plugin");var v=l;exports.default=v;exports.plugin=l;Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
7
+ function s(t={}){return {name:"crypto",dependsOn:[n__default.default(t.env)],config(){return {crypto:p__default.default(t,{salt:`${this.config.name||this.workspaceConfig?.name||this.packageJson?.name}-application`})}},configResolved(){this.dependencies["@noble/ciphers"]="^2.0.1",this.dependencies["@noble/hashes"]="^2.0.1",this.config.crypto.salt??=this.env.parsed.SALT,this.config.crypto.salt||(this.log(types$1.LogLevelLabel.WARN,"No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the `salt` plugin option or the `SALT` environment variable."),this.config.crypto.salt=utils_js.bytesToHex(utils_js.randomBytes(12))),this.config.crypto.encryptionKey??=this.env.parsed.ENCRYPTION_KEY,this.config.crypto.encryptionKey||(this.log(types$1.LogLevelLabel.WARN,"No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the `encryptionKey` plugin option or the `ENCRYPTION_KEY` environment variable."),this.config.crypto.encryptionKey=utils_js.bytesToHex(utils_js.randomBytes(32)));},async prepare(){this.log(types$1.LogLevelLabel.TRACE,"Preparing the Crypto runtime artifacts for the Powerlines project."),await this.emitBuiltin(await Promise.resolve(crypto.cryptoModule(this)),"crypto","crypto.ts");}}}chunkFBBMZ4NC_cjs.a(s,"plugin");var P=s;exports.default=P;exports.plugin=s;Object.keys(components).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return components[k]}})});Object.keys(types).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return types[k]}})});
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-sWc0GdCe.cjs';
2
- export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from './index-sWc0GdCe.cjs';
1
+ import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-CKLwxWIp.cjs';
2
+ export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from './index-CKLwxWIp.cjs';
3
3
  export { cryptoModule } from './components/crypto.cjs';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@deepkit/type';
@@ -16,8 +16,11 @@ import '@babel/helper-plugin-utils';
16
16
  import '@stryke/env/get-env-paths';
17
17
  import '@stryke/types/package-json';
18
18
  import 'jiti';
19
+ import 'magic-string';
19
20
  import 'semver';
21
+ import 'ts-morph';
20
22
  import 'unplugin';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/tsconfig';
23
26
  import 'typescript';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-sWc0GdCe.js';
2
- export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from './index-sWc0GdCe.js';
1
+ import { C as CryptoPluginOptions, P as Plugin, a as CryptoPluginContext } from './index-CKLwxWIp.js';
2
+ export { c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from './index-CKLwxWIp.js';
3
3
  export { cryptoModule } from './components/crypto.js';
4
4
  import '@alloy-js/core/jsx-runtime';
5
5
  import '@deepkit/type';
@@ -16,8 +16,11 @@ import '@babel/helper-plugin-utils';
16
16
  import '@stryke/env/get-env-paths';
17
17
  import '@stryke/types/package-json';
18
18
  import 'jiti';
19
+ import 'magic-string';
19
20
  import 'semver';
21
+ import 'ts-morph';
20
22
  import 'unplugin';
23
+ import '@stryke/fs/resolve';
21
24
  import 'node:fs';
22
25
  import '@stryke/types/tsconfig';
23
26
  import 'typescript';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import {a}from'./chunk-UCUR73HG.js';import {bytesToHex,randomBytes}from'@noble/ciphers/utils.js';import n from'@powerlines/plugin-env';import {LogLevelLabel}from'@storm-software/config-tools/types';import {cryptoModule}from'./components/crypto';export*from'./components';export*from'./types';/*****************************************
1
+ import {a}from'./chunk-UCUR73HG.js';import {bytesToHex,randomBytes}from'@noble/ciphers/utils.js';import n from'@powerlines/plugin-env';import {LogLevelLabel}from'@storm-software/config-tools/types';import p from'defu';import {cryptoModule}from'./components/crypto';export*from'./components';export*from'./types';/*****************************************
2
2
  *
3
3
  * ⚡ Built by Storm Software
4
4
  *
5
5
  *****************************************/
6
6
 
7
- function l(e={}){return {name:"crypto",dependsOn:[n(e.env)],config(){return {crypto:{salt:e.salt,encryptionKey:e.encryptionKey}}},configResolved(){this.dependencies["@noble/ciphers"]="^2.0.1",this.dependencies["@noble/hashes"]="^2.0.1",this.config.crypto.salt??=this.env.parsed.SALT,this.config.crypto.salt||(this.log(LogLevelLabel.WARN,"No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the `salt` plugin option or the `SALT` environment variable."),this.config.crypto.salt=bytesToHex(randomBytes(12))),this.config.crypto.encryptionKey??=this.env.parsed.ENCRYPTION_KEY,this.config.crypto.encryptionKey||(this.log(LogLevelLabel.WARN,"No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the `encryptionKey` plugin option or the `ENCRYPTION_KEY` environment variable."),this.config.crypto.encryptionKey=bytesToHex(randomBytes(32)));},async prepare(){this.log(LogLevelLabel.TRACE,"Preparing the Crypto runtime artifacts for the Powerlines project."),await this.emitBuiltin(await Promise.resolve(cryptoModule(this)),"crypto","crypto.ts");}}}a(l,"plugin");var P=l;export{P as default,l as plugin};
7
+ function s(t={}){return {name:"crypto",dependsOn:[n(t.env)],config(){return {crypto:p(t,{salt:`${this.config.name||this.workspaceConfig?.name||this.packageJson?.name}-application`})}},configResolved(){this.dependencies["@noble/ciphers"]="^2.0.1",this.dependencies["@noble/hashes"]="^2.0.1",this.config.crypto.salt??=this.env.parsed.SALT,this.config.crypto.salt||(this.log(LogLevelLabel.WARN,"No salt provided to the Crypto plugin - a salt value will be generated automatically. Please note: It's highly recommended to provide a unique salt value via the `salt` plugin option or the `SALT` environment variable."),this.config.crypto.salt=bytesToHex(randomBytes(12))),this.config.crypto.encryptionKey??=this.env.parsed.ENCRYPTION_KEY,this.config.crypto.encryptionKey||(this.log(LogLevelLabel.WARN,"No encryption key provided to the Crypto plugin - a secure key will be generated automatically. Please note: it's highly recommended to provide a secure encryption key via the `encryptionKey` plugin option or the `ENCRYPTION_KEY` environment variable."),this.config.crypto.encryptionKey=bytesToHex(randomBytes(32)));},async prepare(){this.log(LogLevelLabel.TRACE,"Preparing the Crypto runtime artifacts for the Powerlines project."),await this.emitBuiltin(await Promise.resolve(cryptoModule(this)),"crypto","crypto.ts");}}}a(s,"plugin");var b=s;export{b as default,s as plugin};
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-sWc0GdCe.cjs';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-CKLwxWIp.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-sWc0GdCe.js';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-CKLwxWIp.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-sWc0GdCe.cjs';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-CKLwxWIp.cjs';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
@@ -1,4 +1,4 @@
1
- export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-sWc0GdCe.js';
1
+ export { a as CryptoPluginContext, C as CryptoPluginOptions, c as CryptoPluginResolvedConfig, b as CryptoPluginUserConfig, f as __ΩCryptoPluginContext, _ as __ΩCryptoPluginOptions, e as __ΩCryptoPluginResolvedConfig, d as __ΩCryptoPluginUserConfig } from '../index-CKLwxWIp.js';
2
2
  import '@alloy-js/core/jsx-runtime';
3
3
  import '@deepkit/type';
4
4
  import '@stryke/capnp';
@@ -14,8 +14,11 @@ import '@babel/helper-plugin-utils';
14
14
  import '@stryke/env/get-env-paths';
15
15
  import '@stryke/types/package-json';
16
16
  import 'jiti';
17
+ import 'magic-string';
17
18
  import 'semver';
19
+ import 'ts-morph';
18
20
  import 'unplugin';
21
+ import '@stryke/fs/resolve';
19
22
  import 'node:fs';
20
23
  import '@stryke/types/tsconfig';
21
24
  import 'typescript';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-crypto",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin that provides unique identifier generation capabilities at runtime by adding the `id` builtin module.",
6
6
  "repository": {
@@ -116,18 +116,18 @@
116
116
  "files": ["dist/**/*"],
117
117
  "keywords": ["powerlines", "storm-software", "powerlines-plugin"],
118
118
  "dependencies": {
119
- "@powerlines/plugin-env": "^0.13.33",
119
+ "@powerlines/plugin-env": "^0.13.35",
120
120
  "@storm-software/config-tools": "^1.188.48",
121
- "@stryke/path": "^0.19.2",
121
+ "@stryke/path": "^0.20.0",
122
122
  "defu": "^6.1.4",
123
- "powerlines": "^0.23.10",
123
+ "powerlines": "^0.24.1",
124
124
  "@noble/ciphers": "^2.0.1"
125
125
  },
126
126
  "devDependencies": {
127
- "@powerlines/nx": "^0.10.27",
127
+ "@powerlines/nx": "^0.10.29",
128
128
  "@storm-software/tsup": "^0.2.46",
129
129
  "@types/node": "^24.10.1"
130
130
  },
131
131
  "publishConfig": { "access": "public" },
132
- "gitHead": "5a6b8349dc29bf9e496ed5dee32c6cfb8d9bff4e"
132
+ "gitHead": "424d900c34fbbdf943895648419a6467d8eb4a8d"
133
133
  }