@powerlines/plugin-env 0.13.33 → 0.13.35

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,10 +1,12 @@
1
1
  export { envBabelPlugin } from './plugin.cjs';
2
- import '../runtime-BReFBBeA.cjs';
2
+ import '../runtime-DhSbEPND.cjs';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
+ import 'magic-string';
7
8
  import 'semver';
9
+ import 'ts-morph';
8
10
  import 'unplugin';
9
11
  import '@babel/core';
10
12
  import '@storm-software/build-tools/types';
@@ -14,7 +16,8 @@ import '@stryke/types/configuration';
14
16
  import '@stryke/types/file';
15
17
  import 'vite';
16
18
  import '@babel/helper-plugin-utils';
17
- import '../fs-B3t0EW52.cjs';
19
+ import '../fs-Y3B84fcf.cjs';
20
+ import '@stryke/fs/resolve';
18
21
  import 'node:fs';
19
22
  import '@stryke/types/array';
20
23
  import '@stryke/types/tsconfig';
@@ -1,10 +1,12 @@
1
1
  export { envBabelPlugin } from './plugin.js';
2
- import '../runtime-CNb5EW2L.js';
2
+ import '../runtime-CCwYDwEe.js';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
+ import 'magic-string';
7
8
  import 'semver';
9
+ import 'ts-morph';
8
10
  import 'unplugin';
9
11
  import '@babel/core';
10
12
  import '@storm-software/build-tools/types';
@@ -14,7 +16,8 @@ import '@stryke/types/configuration';
14
16
  import '@stryke/types/file';
15
17
  import 'vite';
16
18
  import '@babel/helper-plugin-utils';
17
- import '../fs-B3t0EW52.js';
19
+ import '../fs-Y3B84fcf.js';
20
+ import '@stryke/fs/resolve';
18
21
  import 'node:fs';
19
22
  import '@stryke/types/array';
20
23
  import '@stryke/types/tsconfig';
@@ -1,10 +1,12 @@
1
- import { D as DeclareBabelTransformPluginReturn } from '../runtime-BReFBBeA.cjs';
1
+ import { D as DeclareBabelTransformPluginReturn } from '../runtime-DhSbEPND.cjs';
2
2
  import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.cjs';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
+ import 'magic-string';
7
8
  import 'semver';
9
+ import 'ts-morph';
8
10
  import 'unplugin';
9
11
  import '@babel/core';
10
12
  import '@storm-software/build-tools/types';
@@ -14,7 +16,8 @@ import '@stryke/types/configuration';
14
16
  import '@stryke/types/file';
15
17
  import 'vite';
16
18
  import '@babel/helper-plugin-utils';
17
- import '../fs-B3t0EW52.cjs';
19
+ import '../fs-Y3B84fcf.cjs';
20
+ import '@stryke/fs/resolve';
18
21
  import 'node:fs';
19
22
  import '@stryke/types/array';
20
23
  import '@stryke/types/tsconfig';
@@ -1,10 +1,12 @@
1
- import { D as DeclareBabelTransformPluginReturn } from '../runtime-CNb5EW2L.js';
1
+ import { D as DeclareBabelTransformPluginReturn } from '../runtime-CCwYDwEe.js';
2
2
  import { EnvPluginContext, EnvPluginResolvedConfig } from '../types/plugin.js';
3
3
  import '@stryke/env/get-env-paths';
4
4
  import '@stryke/types/base';
5
5
  import '@stryke/types/package-json';
6
6
  import 'jiti';
7
+ import 'magic-string';
7
8
  import 'semver';
9
+ import 'ts-morph';
8
10
  import 'unplugin';
9
11
  import '@babel/core';
10
12
  import '@storm-software/build-tools/types';
@@ -14,7 +16,8 @@ import '@stryke/types/configuration';
14
16
  import '@stryke/types/file';
15
17
  import 'vite';
16
18
  import '@babel/helper-plugin-utils';
17
- import '../fs-B3t0EW52.js';
19
+ import '../fs-Y3B84fcf.js';
20
+ import '@stryke/fs/resolve';
18
21
  import 'node:fs';
19
22
  import '@stryke/types/array';
20
23
  import '@stryke/types/tsconfig';
@@ -1,8 +1,9 @@
1
1
  import { Children as Children$1, SourceFileProps as SourceFileProps$1 } from '@alloy-js/core';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
- import { O as OutputModeType } from '../fs-B3t0EW52.cjs';
3
+ import { O as OutputModeType } from '../fs-Y3B84fcf.cjs';
4
4
  import { InterfaceDeclarationProps } from '@alloy-js/typescript';
5
5
  import { ReflectionClass } from '@deepkit/type';
6
+ import '@stryke/fs/resolve';
6
7
  import 'node:fs';
7
8
 
8
9
  /**
@@ -1,8 +1,9 @@
1
1
  import { Children as Children$1, SourceFileProps as SourceFileProps$1 } from '@alloy-js/core';
2
2
  import { Children } from '@alloy-js/core/jsx-runtime';
3
- import { O as OutputModeType } from '../fs-B3t0EW52.js';
3
+ import { O as OutputModeType } from '../fs-Y3B84fcf.js';
4
4
  import { InterfaceDeclarationProps } from '@alloy-js/typescript';
5
5
  import { ReflectionClass } from '@deepkit/type';
6
+ import '@stryke/fs/resolve';
6
7
  import 'node:fs';
7
8
 
8
9
  /**
@@ -1,7 +1,8 @@
1
1
  export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from './env.cjs';
2
2
  import '@alloy-js/core';
3
3
  import '@alloy-js/core/jsx-runtime';
4
- import '../fs-B3t0EW52.cjs';
4
+ import '../fs-Y3B84fcf.cjs';
5
+ import '@stryke/fs/resolve';
5
6
  import 'node:fs';
6
7
  import '@alloy-js/typescript';
7
8
  import '@deepkit/type';
@@ -1,7 +1,8 @@
1
1
  export { EnvBuiltin, EnvBuiltinProps, EnvTypeDefinition, __ΩEnvBuiltinProps } from './env.js';
2
2
  import '@alloy-js/core';
3
3
  import '@alloy-js/core/jsx-runtime';
4
- import '../fs-B3t0EW52.js';
4
+ import '../fs-Y3B84fcf.js';
5
+ import '@stryke/fs/resolve';
5
6
  import 'node:fs';
6
7
  import '@alloy-js/typescript';
7
8
  import '@deepkit/type';
@@ -1,4 +1,5 @@
1
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
1
+ import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
2
+ import { StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
2
3
 
3
4
  declare const __VFS_PATCH__ = "__VFS_PATCH__";
4
5
  declare const __VFS_REVERT__ = "__VFS_REVERT__";
@@ -87,21 +88,27 @@ interface PowerlinesWriteFileOptions extends ResolveFSOptions {
87
88
  type NodeWriteFileOptions = WriteFileOptions$1;
88
89
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
89
90
  type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
90
- interface ResolvePathOptions extends ResolveFSOptions {
91
+ interface ResolveOptions extends ResolveOptions$1 {
91
92
  /**
92
- * Should the resolved path include the file extension?
93
- *
94
- * @defaultValue true
93
+ * If true, the module is being resolved as an entry point.
94
+ */
95
+ isEntry?: boolean;
96
+ /**
97
+ * If true, the resolver will skip using the cache when resolving modules.
98
+ */
99
+ skipCache?: boolean;
100
+ /**
101
+ * An array of external modules or patterns to exclude from resolution.
95
102
  */
96
- withExtension?: boolean;
103
+ external?: (string | RegExp)[];
97
104
  /**
98
- * The paths to search for the file.
105
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
99
106
  */
100
- paths?: string[];
107
+ noExternal?: (string | RegExp)[];
101
108
  /**
102
- * The type of the path to resolve.
109
+ * An array of patterns to match when resolving modules.
103
110
  */
104
- pathType?: "file" | "directory";
111
+ skipNodeModulesBundle?: boolean;
105
112
  }
106
113
  interface VirtualFileSystemInterface {
107
114
  /**
@@ -115,27 +122,33 @@ interface VirtualFileSystemInterface {
115
122
  /**
116
123
  * The underlying file metadata.
117
124
  */
118
- metadata: Record<string, VirtualFileMetadata | undefined>;
125
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
126
+ /**
127
+ * A map of file paths to their module ids.
128
+ */
129
+ ids: Readonly<Record<string, string>>;
119
130
  /**
120
131
  * A map of module ids to their file paths.
121
132
  */
122
- ids: Record<string, string>;
133
+ paths: Readonly<Record<string, string>>;
123
134
  /**
124
135
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
125
136
  *
126
137
  * @param pathOrId - The path or id to check.
138
+ * @param importer - The importer path, if any.
127
139
  * @param options - Optional parameters for resolving the path.
128
140
  * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
129
141
  */
130
- isVirtual: (pathOrId: string, options?: ResolvePathOptions) => boolean;
142
+ isVirtual: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
131
143
  /**
132
144
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
133
145
  *
134
146
  * @param pathOrId - The path or id to check.
147
+ * @param importer - The importer path, if any.
135
148
  * @param options - Optional parameters for resolving the path.
136
149
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
137
150
  */
138
- isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
151
+ isPhysical: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
139
152
  /**
140
153
  * Checks if a file exists in the virtual file system (VFS).
141
154
  *
@@ -163,7 +176,7 @@ interface VirtualFileSystemInterface {
163
176
  * @param pathOrId - The path or id of the file.
164
177
  * @returns The metadata of the file if it exists, otherwise undefined.
165
178
  */
166
- getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
179
+ getMetadata: (pathOrId: string) => VirtualFileMetadata | undefined;
167
180
  /**
168
181
  * Gets the stats of a file in the virtual file system (VFS).
169
182
  *
@@ -236,7 +249,7 @@ interface VirtualFileSystemInterface {
236
249
  * @param path - The path to the file to remove.
237
250
  * @returns A promise that resolves when the file is removed.
238
251
  */
239
- unlinkSync: (path: PathLike, options?: ResolveFSOptions) => void;
252
+ unlinkSync: (path: string, options?: ResolveFSOptions) => void;
240
253
  /**
241
254
  * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
242
255
  *
@@ -250,7 +263,7 @@ interface VirtualFileSystemInterface {
250
263
  * @param path - The path to create the directory at.
251
264
  * @param options - Options for creating the directory.
252
265
  */
253
- rmdirSync: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => any;
266
+ rmdirSync: (path: string, options?: RmDirOptions & ResolveFSOptions) => any;
254
267
  /**
255
268
  * Removes a directory in the virtual file system (VFS).
256
269
  *
@@ -258,7 +271,7 @@ interface VirtualFileSystemInterface {
258
271
  * @param options - Options for creating the directory.
259
272
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
260
273
  */
261
- rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
274
+ rmdir: (path: string, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
262
275
  /**
263
276
  * Removes a file or directory in the virtual file system (VFS).
264
277
  *
@@ -266,14 +279,14 @@ interface VirtualFileSystemInterface {
266
279
  * @param options - Options for removing the file or directory.
267
280
  * @returns A promise that resolves when the file or directory is removed.
268
281
  */
269
- rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
282
+ rm: (path: string, options?: RmOptions & ResolveFSOptions) => Promise<void>;
270
283
  /**
271
284
  * Synchronously removes a file or directory in the virtual file system (VFS).
272
285
  *
273
286
  * @param path - The path to the file or directory to remove.
274
287
  * @param options - Options for removing the file or directory.
275
288
  */
276
- rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
289
+ rmSync: (path: string, options?: RmOptions & ResolveFSOptions) => void;
277
290
  /**
278
291
  * Creates a directory in the virtual file system (VFS).
279
292
  *
@@ -281,7 +294,7 @@ interface VirtualFileSystemInterface {
281
294
  * @param options - Options for creating the directory.
282
295
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
283
296
  */
284
- mkdirSync: (path: PathLike, options?: MakeDirectoryOptions) => string | undefined;
297
+ mkdirSync: (path: string, options?: MakeDirectoryOptions) => string | undefined;
285
298
  /**
286
299
  * Creates a directory in the virtual file system (VFS).
287
300
  *
@@ -289,7 +302,7 @@ interface VirtualFileSystemInterface {
289
302
  * @param options - Options for creating the directory.
290
303
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
291
304
  */
292
- mkdir: (path: PathLike, options?: MakeDirectoryOptions) => Promise<string | undefined>;
305
+ mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
293
306
  /**
294
307
  * Reads a file from the virtual file system (VFS).
295
308
  *
@@ -311,7 +324,7 @@ interface VirtualFileSystemInterface {
311
324
  * @param options - Optional parameters for writing the file.
312
325
  * @returns A promise that resolves when the file is written.
313
326
  */
314
- writeFile: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
327
+ writeFile: (path: string, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
315
328
  /**
316
329
  * Writes a file to the virtual file system (VFS).
317
330
  *
@@ -319,7 +332,7 @@ interface VirtualFileSystemInterface {
319
332
  * @param data - The contents of the file.
320
333
  * @param options - Optional parameters for writing the file.
321
334
  */
322
- writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
335
+ writeFileSync: (path: string, data?: WriteFileData, options?: WriteFileOptions) => void;
323
336
  /**
324
337
  * Moves a file from one path to another in the virtual file system (VFS).
325
338
  *
@@ -366,28 +379,47 @@ interface VirtualFileSystemInterface {
366
379
  * Resolves a path or id to a file path in the virtual file system.
367
380
  *
368
381
  * @param pathOrId - The path or id of the file to resolve.
369
- * @param options - Optional parameters for resolving the path.
370
382
  * @returns The resolved path of the file if it exists, otherwise false.
371
383
  */
372
- resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
384
+ realpathSync: (pathOrId: string) => string;
373
385
  /**
374
- * Formats a path to match the virtual file system (VFS) structure.
386
+ * A helper function to resolve modules using the Jiti resolver
375
387
  *
376
- * @param path - The path to format.
377
- * @returns The formatted path.
388
+ * @remarks
389
+ * This function can be used to resolve modules relative to the project root directory.
390
+ *
391
+ * @example
392
+ * ```ts
393
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
394
+ * ```
395
+ *
396
+ * @param id - The module to resolve.
397
+ * @param importer - An optional path to the importer module.
398
+ * @param options - Additional resolution options.
399
+ * @returns A promise that resolves to the resolved module path.
378
400
  */
379
- formatPath: (path: string) => string;
401
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<string | undefined>;
380
402
  /**
381
- * Resolves a path or id to a file path in the virtual file system.
403
+ * A synchronous helper function to resolve modules using the Jiti resolver
382
404
  *
383
- * @param pathOrId - The path or id of the file to resolve.
384
- * @returns The resolved path of the file if it exists, otherwise false.
405
+ * @remarks
406
+ * This function can be used to resolve modules relative to the project root directory.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
411
+ * ```
412
+ *
413
+ * @param id - The module to resolve.
414
+ * @param importer - An optional path to the importer module.
415
+ * @param options - Additional resolution options.
416
+ * @returns The resolved module path.
385
417
  */
386
- realpathSync: (pathOrId: string) => string;
418
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions) => string | undefined;
387
419
  /**
388
420
  * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
389
421
  */
390
422
  dispose: () => Promise<void>;
391
423
  }
392
424
 
393
- export type { OutputModeType as O, PowerlinesWriteFileOptions as P, VirtualFileSystemInterface as V, VirtualFile as a };
425
+ export type { OutputModeType as O, PowerlinesWriteFileOptions as P, ResolveOptions as R, VirtualFileSystemInterface as V, VirtualFile as a };
@@ -1,4 +1,5 @@
1
- import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
1
+ import { ResolveOptions as ResolveOptions$1 } from '@stryke/fs/resolve';
2
+ import { StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
2
3
 
3
4
  declare const __VFS_PATCH__ = "__VFS_PATCH__";
4
5
  declare const __VFS_REVERT__ = "__VFS_REVERT__";
@@ -87,21 +88,27 @@ interface PowerlinesWriteFileOptions extends ResolveFSOptions {
87
88
  type NodeWriteFileOptions = WriteFileOptions$1;
88
89
  type WriteFileOptions = NodeWriteFileOptions | PowerlinesWriteFileOptions;
89
90
  type WriteFileData = string | NodeJS.ArrayBufferView | VirtualFileData;
90
- interface ResolvePathOptions extends ResolveFSOptions {
91
+ interface ResolveOptions extends ResolveOptions$1 {
91
92
  /**
92
- * Should the resolved path include the file extension?
93
- *
94
- * @defaultValue true
93
+ * If true, the module is being resolved as an entry point.
94
+ */
95
+ isEntry?: boolean;
96
+ /**
97
+ * If true, the resolver will skip using the cache when resolving modules.
98
+ */
99
+ skipCache?: boolean;
100
+ /**
101
+ * An array of external modules or patterns to exclude from resolution.
95
102
  */
96
- withExtension?: boolean;
103
+ external?: (string | RegExp)[];
97
104
  /**
98
- * The paths to search for the file.
105
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
99
106
  */
100
- paths?: string[];
107
+ noExternal?: (string | RegExp)[];
101
108
  /**
102
- * The type of the path to resolve.
109
+ * An array of patterns to match when resolving modules.
103
110
  */
104
- pathType?: "file" | "directory";
111
+ skipNodeModulesBundle?: boolean;
105
112
  }
106
113
  interface VirtualFileSystemInterface {
107
114
  /**
@@ -115,27 +122,33 @@ interface VirtualFileSystemInterface {
115
122
  /**
116
123
  * The underlying file metadata.
117
124
  */
118
- metadata: Record<string, VirtualFileMetadata | undefined>;
125
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
126
+ /**
127
+ * A map of file paths to their module ids.
128
+ */
129
+ ids: Readonly<Record<string, string>>;
119
130
  /**
120
131
  * A map of module ids to their file paths.
121
132
  */
122
- ids: Record<string, string>;
133
+ paths: Readonly<Record<string, string>>;
123
134
  /**
124
135
  * Check if a path or id corresponds to a virtual file **(does not actually exists on disk)**.
125
136
  *
126
137
  * @param pathOrId - The path or id to check.
138
+ * @param importer - The importer path, if any.
127
139
  * @param options - Optional parameters for resolving the path.
128
140
  * @returns Whether the path or id corresponds to a virtual file **(does not actually exists on disk)**.
129
141
  */
130
- isVirtual: (pathOrId: string, options?: ResolvePathOptions) => boolean;
142
+ isVirtual: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
131
143
  /**
132
144
  * Check if a path or id corresponds to a file written to the file system **(actually exists on disk)**.
133
145
  *
134
146
  * @param pathOrId - The path or id to check.
147
+ * @param importer - The importer path, if any.
135
148
  * @param options - Optional parameters for resolving the path.
136
149
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
137
150
  */
138
- isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
151
+ isPhysical: (pathOrId: string, importer?: string, options?: ResolveOptions) => boolean;
139
152
  /**
140
153
  * Checks if a file exists in the virtual file system (VFS).
141
154
  *
@@ -163,7 +176,7 @@ interface VirtualFileSystemInterface {
163
176
  * @param pathOrId - The path or id of the file.
164
177
  * @returns The metadata of the file if it exists, otherwise undefined.
165
178
  */
166
- getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
179
+ getMetadata: (pathOrId: string) => VirtualFileMetadata | undefined;
167
180
  /**
168
181
  * Gets the stats of a file in the virtual file system (VFS).
169
182
  *
@@ -236,7 +249,7 @@ interface VirtualFileSystemInterface {
236
249
  * @param path - The path to the file to remove.
237
250
  * @returns A promise that resolves when the file is removed.
238
251
  */
239
- unlinkSync: (path: PathLike, options?: ResolveFSOptions) => void;
252
+ unlinkSync: (path: string, options?: ResolveFSOptions) => void;
240
253
  /**
241
254
  * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
242
255
  *
@@ -250,7 +263,7 @@ interface VirtualFileSystemInterface {
250
263
  * @param path - The path to create the directory at.
251
264
  * @param options - Options for creating the directory.
252
265
  */
253
- rmdirSync: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => any;
266
+ rmdirSync: (path: string, options?: RmDirOptions & ResolveFSOptions) => any;
254
267
  /**
255
268
  * Removes a directory in the virtual file system (VFS).
256
269
  *
@@ -258,7 +271,7 @@ interface VirtualFileSystemInterface {
258
271
  * @param options - Options for creating the directory.
259
272
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
260
273
  */
261
- rmdir: (path: PathLike, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
274
+ rmdir: (path: string, options?: RmDirOptions & ResolveFSOptions) => Promise<void>;
262
275
  /**
263
276
  * Removes a file or directory in the virtual file system (VFS).
264
277
  *
@@ -266,14 +279,14 @@ interface VirtualFileSystemInterface {
266
279
  * @param options - Options for removing the file or directory.
267
280
  * @returns A promise that resolves when the file or directory is removed.
268
281
  */
269
- rm: (path: PathLike, options?: RmOptions & ResolveFSOptions) => Promise<void>;
282
+ rm: (path: string, options?: RmOptions & ResolveFSOptions) => Promise<void>;
270
283
  /**
271
284
  * Synchronously removes a file or directory in the virtual file system (VFS).
272
285
  *
273
286
  * @param path - The path to the file or directory to remove.
274
287
  * @param options - Options for removing the file or directory.
275
288
  */
276
- rmSync: (path: PathLike, options?: RmOptions & ResolveFSOptions) => void;
289
+ rmSync: (path: string, options?: RmOptions & ResolveFSOptions) => void;
277
290
  /**
278
291
  * Creates a directory in the virtual file system (VFS).
279
292
  *
@@ -281,7 +294,7 @@ interface VirtualFileSystemInterface {
281
294
  * @param options - Options for creating the directory.
282
295
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
283
296
  */
284
- mkdirSync: (path: PathLike, options?: MakeDirectoryOptions) => string | undefined;
297
+ mkdirSync: (path: string, options?: MakeDirectoryOptions) => string | undefined;
285
298
  /**
286
299
  * Creates a directory in the virtual file system (VFS).
287
300
  *
@@ -289,7 +302,7 @@ interface VirtualFileSystemInterface {
289
302
  * @param options - Options for creating the directory.
290
303
  * @returns A promise that resolves to the path of the created directory, or undefined if the directory could not be created.
291
304
  */
292
- mkdir: (path: PathLike, options?: MakeDirectoryOptions) => Promise<string | undefined>;
305
+ mkdir: (path: string, options?: MakeDirectoryOptions) => Promise<string | undefined>;
293
306
  /**
294
307
  * Reads a file from the virtual file system (VFS).
295
308
  *
@@ -311,7 +324,7 @@ interface VirtualFileSystemInterface {
311
324
  * @param options - Optional parameters for writing the file.
312
325
  * @returns A promise that resolves when the file is written.
313
326
  */
314
- writeFile: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
327
+ writeFile: (path: string, data?: WriteFileData, options?: WriteFileOptions) => Promise<void>;
315
328
  /**
316
329
  * Writes a file to the virtual file system (VFS).
317
330
  *
@@ -319,7 +332,7 @@ interface VirtualFileSystemInterface {
319
332
  * @param data - The contents of the file.
320
333
  * @param options - Optional parameters for writing the file.
321
334
  */
322
- writeFileSync: (path: PathOrFileDescriptor, data?: WriteFileData, options?: WriteFileOptions) => void;
335
+ writeFileSync: (path: string, data?: WriteFileData, options?: WriteFileOptions) => void;
323
336
  /**
324
337
  * Moves a file from one path to another in the virtual file system (VFS).
325
338
  *
@@ -366,28 +379,47 @@ interface VirtualFileSystemInterface {
366
379
  * Resolves a path or id to a file path in the virtual file system.
367
380
  *
368
381
  * @param pathOrId - The path or id of the file to resolve.
369
- * @param options - Optional parameters for resolving the path.
370
382
  * @returns The resolved path of the file if it exists, otherwise false.
371
383
  */
372
- resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
384
+ realpathSync: (pathOrId: string) => string;
373
385
  /**
374
- * Formats a path to match the virtual file system (VFS) structure.
386
+ * A helper function to resolve modules using the Jiti resolver
375
387
  *
376
- * @param path - The path to format.
377
- * @returns The formatted path.
388
+ * @remarks
389
+ * This function can be used to resolve modules relative to the project root directory.
390
+ *
391
+ * @example
392
+ * ```ts
393
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
394
+ * ```
395
+ *
396
+ * @param id - The module to resolve.
397
+ * @param importer - An optional path to the importer module.
398
+ * @param options - Additional resolution options.
399
+ * @returns A promise that resolves to the resolved module path.
378
400
  */
379
- formatPath: (path: string) => string;
401
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<string | undefined>;
380
402
  /**
381
- * Resolves a path or id to a file path in the virtual file system.
403
+ * A synchronous helper function to resolve modules using the Jiti resolver
382
404
  *
383
- * @param pathOrId - The path or id of the file to resolve.
384
- * @returns The resolved path of the file if it exists, otherwise false.
405
+ * @remarks
406
+ * This function can be used to resolve modules relative to the project root directory.
407
+ *
408
+ * @example
409
+ * ```ts
410
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
411
+ * ```
412
+ *
413
+ * @param id - The module to resolve.
414
+ * @param importer - An optional path to the importer module.
415
+ * @param options - Additional resolution options.
416
+ * @returns The resolved module path.
385
417
  */
386
- realpathSync: (pathOrId: string) => string;
418
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions) => string | undefined;
387
419
  /**
388
420
  * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
389
421
  */
390
422
  dispose: () => Promise<void>;
391
423
  }
392
424
 
393
- export type { OutputModeType as O, PowerlinesWriteFileOptions as P, VirtualFileSystemInterface as V, VirtualFile as a };
425
+ export type { OutputModeType as O, PowerlinesWriteFileOptions as P, ResolveOptions as R, VirtualFileSystemInterface as V, VirtualFile as a };
@@ -3,12 +3,14 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
3
3
  export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from './reflect.cjs';
4
4
  export { formatEnvField, removeEnvPrefix } from './source-file-env.cjs';
5
5
  export { createTemplateReflection } from './template-helpers.cjs';
6
- import '../runtime-BReFBBeA.cjs';
6
+ import '../runtime-DhSbEPND.cjs';
7
7
  import '@stryke/env/get-env-paths';
8
8
  import '@stryke/types/base';
9
9
  import '@stryke/types/package-json';
10
10
  import 'jiti';
11
+ import 'magic-string';
11
12
  import 'semver';
13
+ import 'ts-morph';
12
14
  import 'unplugin';
13
15
  import '@babel/core';
14
16
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@stryke/types/configuration';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.cjs';
23
+ import '../fs-Y3B84fcf.cjs';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';
@@ -3,12 +3,14 @@ export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectio
3
3
  export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from './reflect.js';
4
4
  export { formatEnvField, removeEnvPrefix } from './source-file-env.js';
5
5
  export { createTemplateReflection } from './template-helpers.js';
6
- import '../runtime-CNb5EW2L.js';
6
+ import '../runtime-CCwYDwEe.js';
7
7
  import '@stryke/env/get-env-paths';
8
8
  import '@stryke/types/base';
9
9
  import '@stryke/types/package-json';
10
10
  import 'jiti';
11
+ import 'magic-string';
11
12
  import 'semver';
13
+ import 'ts-morph';
12
14
  import 'unplugin';
13
15
  import '@babel/core';
14
16
  import '@storm-software/build-tools/types';
@@ -18,7 +20,8 @@ import '@stryke/types/configuration';
18
20
  import '@stryke/types/file';
19
21
  import 'vite';
20
22
  import '@babel/helper-plugin-utils';
21
- import '../fs-B3t0EW52.js';
23
+ import '../fs-Y3B84fcf.js';
24
+ import '@stryke/fs/resolve';
22
25
  import 'node:fs';
23
26
  import '@stryke/types/array';
24
27
  import '@stryke/types/tsconfig';