@powerlines/plugin-env 0.13.15 → 0.13.17

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,13 +1,8 @@
1
1
  import { PrimitiveJsonValue } from '@stryke/json/types';
2
- import { Volume } from 'memfs';
3
2
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
4
- import { IUnionFs } from 'unionfs';
5
3
 
6
- declare const __VFS_INIT__ = "__VFS_INIT__";
7
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
8
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
9
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
10
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
4
+ declare const __VFS_PATCH__: unique symbol;
5
+ declare const __VFS_REVERT__: unique symbol;
11
6
  type OutputModeType = "fs" | "virtual";
12
7
  interface VirtualFile {
13
8
  /**
@@ -47,7 +42,24 @@ interface VirtualFile {
47
42
  */
48
43
  code: string | NodeJS.ArrayBufferView;
49
44
  }
50
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
45
+ interface VirtualFileMetadata {
46
+ /**
47
+ * The identifier for the file data.
48
+ */
49
+ id: string;
50
+ /**
51
+ * The variant of the file.
52
+ */
53
+ variant: string;
54
+ /**
55
+ * The output mode of the file.
56
+ */
57
+ mode: string;
58
+ /**
59
+ * Additional metadata associated with the file.
60
+ */
61
+ properties: Record<string, string>;
62
+ }
51
63
  interface ResolveFSOptions {
52
64
  mode?: OutputModeType;
53
65
  }
@@ -76,12 +88,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
76
88
  type?: "file" | "directory";
77
89
  }
78
90
  interface VirtualFileSystemInterface {
79
- [__VFS_INIT__]: () => void;
91
+ /**
92
+ * Patches the File System to include the virtual file system (VFS) contents.
93
+ */
94
+ [__VFS_PATCH__]: () => void;
95
+ /**
96
+ * Reverts the virtual file system (VFS) to its previous state.
97
+ */
80
98
  [__VFS_REVERT__]: () => void;
81
99
  /**
82
100
  * The underlying file metadata.
83
101
  */
84
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
102
+ metadata: Record<string, VirtualFileMetadata | undefined>;
85
103
  /**
86
104
  * A map of module ids to their file paths.
87
105
  */
@@ -101,7 +119,7 @@ interface VirtualFileSystemInterface {
101
119
  * @param options - Optional parameters for resolving the path.
102
120
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
103
121
  */
104
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
122
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
105
123
  /**
106
124
  * Checks if a file exists in the virtual file system (VFS).
107
125
  *
@@ -116,15 +134,6 @@ interface VirtualFileSystemInterface {
116
134
  * @returns `true` if the directory exists, otherwise `false`.
117
135
  */
118
136
  isDirectory: (path: string) => boolean;
119
- /**
120
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
121
- *
122
- * @see https://www.typescriptlang.org/tsconfig#paths
123
- *
124
- * @param pathOrId - The path or id to check.
125
- * @returns Whether the path or id corresponds to a virtual file.
126
- */
127
- isTsconfigPath: (pathOrId: string) => boolean;
128
137
  /**
129
138
  * Checks if a file exists in the virtual file system (VFS).
130
139
  *
@@ -138,7 +147,7 @@ interface VirtualFileSystemInterface {
138
147
  * @param pathOrId - The path or id of the file.
139
148
  * @returns The metadata of the file if it exists, otherwise undefined.
140
149
  */
141
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
150
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
142
151
  /**
143
152
  * Gets the stats of a file in the virtual file system (VFS).
144
153
  *
@@ -346,23 +355,12 @@ interface VirtualFileSystemInterface {
346
355
  */
347
356
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
348
357
  /**
349
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
358
+ * Formats a path to match the virtual file system (VFS) structure.
350
359
  *
351
- * @see https://www.typescriptlang.org/tsconfig#paths
352
- *
353
- * @param path - The path to check.
354
- * @returns The resolved file path if it exists, otherwise undefined.
360
+ * @param path - The path to format.
361
+ * @returns The formatted path.
355
362
  */
356
- resolveTsconfigPath: (path: string) => string | false;
357
- /**
358
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
359
- *
360
- * @see https://www.typescriptlang.org/tsconfig#paths
361
- *
362
- * @param path - The path to check.
363
- * @returns The resolved package name if it exists, otherwise undefined.
364
- */
365
- resolveTsconfigPathPackage: (path: string) => string | false;
363
+ formatPath: (path: string) => string;
366
364
  /**
367
365
  * Resolves a path or id to a file path in the virtual file system.
368
366
  *
@@ -371,23 +369,9 @@ interface VirtualFileSystemInterface {
371
369
  */
372
370
  realpathSync: (pathOrId: string) => string;
373
371
  /**
374
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
375
- *
376
- * @returns A record mapping file paths to their partial metadata.
377
- */
378
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
379
- /**
380
- * A map of cached file paths to their underlying file content.
381
- */
382
- [__VFS_CACHE__]: Map<string, string>;
383
- /**
384
- * A reference to the underlying virtual file system.
385
- */
386
- [__VFS_VIRTUAL__]: Volume;
387
- /**
388
- * A reference to the underlying unified file system.
372
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
389
373
  */
390
- [__VFS_UNIFIED__]: IUnionFs;
374
+ dispose: () => Promise<void>;
391
375
  }
392
376
 
393
377
  export type { OutputModeType as O, PowerlinesWriteFileOptions as P, VirtualFileSystemInterface as V, VirtualFile as a };
@@ -1,13 +1,8 @@
1
1
  import { PrimitiveJsonValue } from '@stryke/json/types';
2
- import { Volume } from 'memfs';
3
2
  import { PathLike, StatSyncOptions, Stats, RmDirOptions, RmOptions, Mode, MakeDirectoryOptions as MakeDirectoryOptions$1, PathOrFileDescriptor, WriteFileOptions as WriteFileOptions$1 } from 'node:fs';
4
- import { IUnionFs } from 'unionfs';
5
3
 
6
- declare const __VFS_INIT__ = "__VFS_INIT__";
7
- declare const __VFS_REVERT__ = "__VFS_REVERT__";
8
- declare const __VFS_CACHE__ = "__VFS_CACHE__";
9
- declare const __VFS_VIRTUAL__ = "__VFS_VIRTUAL__";
10
- declare const __VFS_UNIFIED__ = "__VFS_UNIFIED__";
4
+ declare const __VFS_PATCH__: unique symbol;
5
+ declare const __VFS_REVERT__: unique symbol;
11
6
  type OutputModeType = "fs" | "virtual";
12
7
  interface VirtualFile {
13
8
  /**
@@ -47,7 +42,24 @@ interface VirtualFile {
47
42
  */
48
43
  code: string | NodeJS.ArrayBufferView;
49
44
  }
50
- type VirtualFileSystemMetadata = Pick<VirtualFile, "id" | "details" | "variant" | "mode">;
45
+ interface VirtualFileMetadata {
46
+ /**
47
+ * The identifier for the file data.
48
+ */
49
+ id: string;
50
+ /**
51
+ * The variant of the file.
52
+ */
53
+ variant: string;
54
+ /**
55
+ * The output mode of the file.
56
+ */
57
+ mode: string;
58
+ /**
59
+ * Additional metadata associated with the file.
60
+ */
61
+ properties: Record<string, string>;
62
+ }
51
63
  interface ResolveFSOptions {
52
64
  mode?: OutputModeType;
53
65
  }
@@ -76,12 +88,18 @@ interface ResolvePathOptions extends ResolveFSOptions {
76
88
  type?: "file" | "directory";
77
89
  }
78
90
  interface VirtualFileSystemInterface {
79
- [__VFS_INIT__]: () => void;
91
+ /**
92
+ * Patches the File System to include the virtual file system (VFS) contents.
93
+ */
94
+ [__VFS_PATCH__]: () => void;
95
+ /**
96
+ * Reverts the virtual file system (VFS) to its previous state.
97
+ */
80
98
  [__VFS_REVERT__]: () => void;
81
99
  /**
82
100
  * The underlying file metadata.
83
101
  */
84
- meta: Record<string, VirtualFileSystemMetadata | undefined>;
102
+ metadata: Record<string, VirtualFileMetadata | undefined>;
85
103
  /**
86
104
  * A map of module ids to their file paths.
87
105
  */
@@ -101,7 +119,7 @@ interface VirtualFileSystemInterface {
101
119
  * @param options - Optional parameters for resolving the path.
102
120
  * @returns Whether the path or id corresponds to a file written to the file system **(actually exists on disk)**.
103
121
  */
104
- isFs: (pathOrId: string, options?: ResolvePathOptions) => boolean;
122
+ isPhysical: (pathOrId: string, options?: ResolvePathOptions) => boolean;
105
123
  /**
106
124
  * Checks if a file exists in the virtual file system (VFS).
107
125
  *
@@ -116,15 +134,6 @@ interface VirtualFileSystemInterface {
116
134
  * @returns `true` if the directory exists, otherwise `false`.
117
135
  */
118
136
  isDirectory: (path: string) => boolean;
119
- /**
120
- * Check if a path exists within one of the directories specified in the tsconfig.json's `path` field.
121
- *
122
- * @see https://www.typescriptlang.org/tsconfig#paths
123
- *
124
- * @param pathOrId - The path or id to check.
125
- * @returns Whether the path or id corresponds to a virtual file.
126
- */
127
- isTsconfigPath: (pathOrId: string) => boolean;
128
137
  /**
129
138
  * Checks if a file exists in the virtual file system (VFS).
130
139
  *
@@ -138,7 +147,7 @@ interface VirtualFileSystemInterface {
138
147
  * @param pathOrId - The path or id of the file.
139
148
  * @returns The metadata of the file if it exists, otherwise undefined.
140
149
  */
141
- getMetadata: (pathOrId: PathLike) => VirtualFileSystemMetadata | undefined;
150
+ getMetadata: (pathOrId: PathLike) => VirtualFileMetadata | undefined;
142
151
  /**
143
152
  * Gets the stats of a file in the virtual file system (VFS).
144
153
  *
@@ -346,23 +355,12 @@ interface VirtualFileSystemInterface {
346
355
  */
347
356
  resolve: (pathOrId: string, options?: ResolvePathOptions) => string | false;
348
357
  /**
349
- * Resolves a path based on TypeScript's `tsconfig.json` paths.
358
+ * Formats a path to match the virtual file system (VFS) structure.
350
359
  *
351
- * @see https://www.typescriptlang.org/tsconfig#paths
352
- *
353
- * @param path - The path to check.
354
- * @returns The resolved file path if it exists, otherwise undefined.
360
+ * @param path - The path to format.
361
+ * @returns The formatted path.
355
362
  */
356
- resolveTsconfigPath: (path: string) => string | false;
357
- /**
358
- * Resolves a package name based on TypeScript's `tsconfig.json` paths.
359
- *
360
- * @see https://www.typescriptlang.org/tsconfig#paths
361
- *
362
- * @param path - The path to check.
363
- * @returns The resolved package name if it exists, otherwise undefined.
364
- */
365
- resolveTsconfigPathPackage: (path: string) => string | false;
363
+ formatPath: (path: string) => string;
366
364
  /**
367
365
  * Resolves a path or id to a file path in the virtual file system.
368
366
  *
@@ -371,23 +369,9 @@ interface VirtualFileSystemInterface {
371
369
  */
372
370
  realpathSync: (pathOrId: string) => string;
373
371
  /**
374
- * Retrieves a partial metadata mapping of all files in the virtual file system (VFS).
375
- *
376
- * @returns A record mapping file paths to their partial metadata.
377
- */
378
- getPartialMeta: () => Record<string, Partial<VirtualFileSystemMetadata>>;
379
- /**
380
- * A map of cached file paths to their underlying file content.
381
- */
382
- [__VFS_CACHE__]: Map<string, string>;
383
- /**
384
- * A reference to the underlying virtual file system.
385
- */
386
- [__VFS_VIRTUAL__]: Volume;
387
- /**
388
- * A reference to the underlying unified file system.
372
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
389
373
  */
390
- [__VFS_UNIFIED__]: IUnionFs;
374
+ dispose: () => Promise<void>;
391
375
  }
392
376
 
393
377
  export type { OutputModeType as O, PowerlinesWriteFileOptions as P, VirtualFileSystemInterface as V, VirtualFile as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.13.15",
3
+ "version": "0.13.17",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "repository": {
@@ -179,9 +179,9 @@
179
179
  "@alloy-js/typescript": "^0.20.0",
180
180
  "@babel/core": "^7.28.5",
181
181
  "@babel/types": "^7.28.5",
182
- "@powerlines/alloy": "^0.11.18",
183
- "@powerlines/plugin-babel": "^0.12.18",
184
- "@powerlines/plugin-plugin": "^0.11.17",
182
+ "@powerlines/alloy": "^0.11.20",
183
+ "@powerlines/plugin-babel": "^0.12.20",
184
+ "@powerlines/plugin-plugin": "^0.11.19",
185
185
  "@storm-software/config-tools": "^1.188.40",
186
186
  "@stryke/capnp": "^0.12.21",
187
187
  "@stryke/env": "^0.20.14",
@@ -190,12 +190,12 @@
190
190
  "@stryke/string-format": "^0.12.2",
191
191
  "@stryke/type-checks": "^0.3.12",
192
192
  "@stryke/types": "^0.10.2",
193
- "powerlines": "^0.19.5"
193
+ "powerlines": "^0.21.0"
194
194
  },
195
195
  "devDependencies": {
196
196
  "@alloy-js/babel-preset": "^0.2.1",
197
197
  "@babel/preset-typescript": "^7.28.5",
198
- "@powerlines/nx": "^0.10.9",
198
+ "@powerlines/nx": "^0.10.11",
199
199
  "@storm-software/tsup": "^0.2.38",
200
200
  "@types/node": "^22.19.1",
201
201
  "tsup": "8.4.0",
@@ -203,5 +203,5 @@
203
203
  "vite": "^7.2.2"
204
204
  },
205
205
  "publishConfig": { "access": "public" },
206
- "gitHead": "041609f2ea8770273cff82b402e3abdc3fcd9133"
206
+ "gitHead": "c6ed2ca745c8f340a55758b3102933dc41e83428"
207
207
  }