cspell-io 10.0.1 → 10.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,11 @@
1
1
  import { isFileURL, isUrlLike, toFileURL, toURL, urlBasename, urlParent as urlDirname } from "@cspell/url";
2
2
  import { Buffer } from "node:buffer";
3
3
  import { ServiceBus } from "@cspell/cspell-service-bus";
4
-
5
4
  //#region src/async/asyncIterable.d.ts
6
5
  /**
7
- * Reads an entire iterable and converts it into a promise.
8
- * @param asyncIterable the async iterable to wait for.
9
- */
6
+ * Reads an entire iterable and converts it into a promise.
7
+ * @param asyncIterable the async iterable to wait for.
8
+ */
10
9
  declare function toArray<T>(asyncIterable: AsyncIterable<T> | Iterable<T> | Iterable<Promise<T>>): Promise<T[]>;
11
10
  //#endregion
12
11
  //#region src/models/BufferEncoding.d.ts
@@ -16,47 +15,47 @@ type BufferEncoding = "base64" | "base64url" | "hex" | TextEncoding;
16
15
  //#region src/models/FileResource.d.ts
17
16
  interface FileReference {
18
17
  /**
19
- * The URL of the File
20
- */
18
+ * The URL of the File
19
+ */
21
20
  readonly url: URL;
22
21
  /**
23
- * The filename of the file if known.
24
- * Useful for `data:` urls.
25
- */
22
+ * The filename of the file if known.
23
+ * Useful for `data:` urls.
24
+ */
26
25
  readonly baseFilename?: string | undefined;
27
26
  /**
28
- * The encoding to use when reading the file.
29
- */
27
+ * The encoding to use when reading the file.
28
+ */
30
29
  readonly encoding?: BufferEncoding | undefined;
31
30
  /**
32
- * - `true` if the content had been gzip compressed.
33
- * - `false` if the content was NOT gzip compressed.
34
- * - `undefined` if it is unknown
35
- */
31
+ * - `true` if the content had been gzip compressed.
32
+ * - `false` if the content was NOT gzip compressed.
33
+ * - `undefined` if it is unknown
34
+ */
36
35
  readonly gz?: boolean | undefined;
37
36
  }
38
37
  interface FileResource extends FileReference {
39
38
  /**
40
- * The contents of the file
41
- */
39
+ * The contents of the file
40
+ */
42
41
  readonly content: string | Uint8Array<ArrayBuffer>;
43
42
  }
44
43
  interface TextFileResource extends FileResource {
45
44
  /**
46
- * Extract the text of the file.
47
- * @param encoding - optional encoding to use when decoding the content.
48
- * by default it uses the encoding of the file if one was specified, otherwise it uses `utf8`.
49
- * If the content is a string, then the encoding is ignored.
50
- */
45
+ * Extract the text of the file.
46
+ * @param encoding - optional encoding to use when decoding the content.
47
+ * by default it uses the encoding of the file if one was specified, otherwise it uses `utf8`.
48
+ * If the content is a string, then the encoding is ignored.
49
+ */
51
50
  getText(encoding?: BufferEncoding): string;
52
51
  /**
53
- * Get the bytes of the file.
54
- * @param gunzip - gunzip the data.
55
- * - `true` to gunzip the data before returning it.
56
- * - `false` to return the data as is.
57
- * - `undefined` to gunzip the data if the file is marked as gzipped.
58
- * @returns the bytes of the file.
59
- */
52
+ * Get the bytes of the file.
53
+ * @param gunzip - gunzip the data.
54
+ * - `true` to gunzip the data before returning it.
55
+ * - `false` to return the data as is.
56
+ * - `undefined` to gunzip the data if the file is marked as gzipped.
57
+ * @returns the bytes of the file.
58
+ */
60
59
  getBytes(gunzip?: boolean): Promise<Uint8Array<ArrayBuffer>>;
61
60
  }
62
61
  type UrlOrFilename = string | URL;
@@ -74,9 +73,9 @@ declare class CFileReference implements FileReference {
74
73
  readonly encoding: BufferEncoding | undefined;
75
74
  readonly baseFilename: string | undefined;
76
75
  /**
77
- * Use to ensure the nominal type separation between CFileReference and FileReference
78
- * See: https://github.com/microsoft/TypeScript/wiki/FAQ#when-and-why-are-classes-nominal
79
- */
76
+ * Use to ensure the nominal type separation between CFileReference and FileReference
77
+ * See: https://github.com/microsoft/TypeScript/wiki/FAQ#when-and-why-are-classes-nominal
78
+ */
80
79
  private _?;
81
80
  readonly gz: boolean | undefined;
82
81
  constructor(url: URL, encoding: BufferEncoding | undefined, baseFilename: string | undefined, gz: boolean | undefined);
@@ -117,42 +116,42 @@ declare function renameFileResource(fileResource: FileResource, url: URL): FileR
117
116
  //#endregion
118
117
  //#region src/models/Stats.d.ts
119
118
  /**
120
- * Subset of definition from the Node definition to avoid a dependency upon a specific version of Node
121
- */
119
+ * Subset of definition from the Node definition to avoid a dependency upon a specific version of Node
120
+ */
122
121
  interface Stats {
123
122
  /**
124
- * Size of file in byes, -1 if unknown.
125
- */
123
+ * Size of file in byes, -1 if unknown.
124
+ */
126
125
  size: number;
127
126
  /**
128
- * Modification time, 0 if unknown.
129
- */
127
+ * Modification time, 0 if unknown.
128
+ */
130
129
  mtimeMs: number;
131
130
  /**
132
- * Used by web requests to see if a resource has changed.
133
- */
131
+ * Used by web requests to see if a resource has changed.
132
+ */
134
133
  eTag?: string | undefined;
135
134
  /**
136
- * The file type.
137
- */
135
+ * The file type.
136
+ */
138
137
  fileType?: FileType | undefined;
139
138
  }
140
139
  declare enum FileType {
141
140
  /**
142
- * The file type is unknown.
143
- */
141
+ * The file type is unknown.
142
+ */
144
143
  Unknown = 0,
145
144
  /**
146
- * A regular file.
147
- */
145
+ * A regular file.
146
+ */
148
147
  File = 1,
149
148
  /**
150
- * A directory.
151
- */
149
+ * A directory.
150
+ */
152
151
  Directory = 2,
153
152
  /**
154
- * A symbolic link.
155
- */
153
+ * A symbolic link.
154
+ */
156
155
  SymbolicLink = 64
157
156
  }
158
157
  interface DirEntry {
@@ -163,11 +162,11 @@ interface DirEntry {
163
162
  //#endregion
164
163
  //#region src/common/stat.d.ts
165
164
  /**
166
- * Compare two Stats to see if they have the same value.
167
- * @param left - Stats
168
- * @param right - Stats
169
- * @returns 0 - equal; 1 - left > right; -1 left < right
170
- */
165
+ * Compare two Stats to see if they have the same value.
166
+ * @param left - Stats
167
+ * @param right - Stats
168
+ * @returns 0 - equal; 1 - left > right; -1 left < right
169
+ */
171
170
  declare function compareStats(left: Stats, right: Stats): number;
172
171
  //#endregion
173
172
  //#region src/models/disposable.d.ts
@@ -188,89 +187,89 @@ interface ReadFileOptions$1 {
188
187
  type ReadFileOptionsOrEncoding = ReadFileOptions$1 | BufferEncoding;
189
188
  interface CSpellIO {
190
189
  /**
191
- * Read a file
192
- * @param urlOrFilename - uri of the file to read
193
- * @param options - optional options for reading the file.
194
- * @returns A TextFileResource.
195
- */
190
+ * Read a file
191
+ * @param urlOrFilename - uri of the file to read
192
+ * @param options - optional options for reading the file.
193
+ * @returns A TextFileResource.
194
+ */
196
195
  readFile(urlOrFilename: UrlOrReference$2, options?: ReadFileOptionsOrEncoding): Promise<TextFileResource>;
197
196
  /**
198
- * Read a file in Sync mode.
199
- * Note: `http` requests will fail.
200
- * @param urlOrFilename - uri of the file to read
201
- * @param encoding - optional encoding.
202
- * @returns A TextFileResource.
203
- * @deprecated Use `readFile` instead.
204
- */
197
+ * Read a file in Sync mode.
198
+ * Note: `http` requests will fail.
199
+ * @param urlOrFilename - uri of the file to read
200
+ * @param encoding - optional encoding.
201
+ * @returns A TextFileResource.
202
+ * @deprecated Use `readFile` instead.
203
+ */
205
204
  readFileSync(urlOrFilename: UrlOrReference$2, encoding?: BufferEncoding): TextFileResource;
206
205
  /**
207
- * Write content to a file using utf-8 encoding.
208
- * It will fail to write to non-file uris.
209
- * @param urlOrFilename - uri
210
- * @param content - string to write.
211
- */
206
+ * Write content to a file using utf-8 encoding.
207
+ * It will fail to write to non-file uris.
208
+ * @param urlOrFilename - uri
209
+ * @param content - string to write.
210
+ */
212
211
  writeFile(urlOrFilename: UrlOrReference$2, content: string | ArrayBufferView): Promise<FileReference>;
213
212
  /**
214
- * Read a directory.
215
- * @param urlOrFilename - uri
216
- */
213
+ * Read a directory.
214
+ * @param urlOrFilename - uri
215
+ */
217
216
  readDirectory(urlOrFilename: string | URL): Promise<DirEntry[]>;
218
217
  /**
219
- * Get Stats on a uri.
220
- * @param urlOrFilename - uri to fetch stats on
221
- * @returns Stats if successful.
222
- */
218
+ * Get Stats on a uri.
219
+ * @param urlOrFilename - uri to fetch stats on
220
+ * @returns Stats if successful.
221
+ */
223
222
  getStat(urlOrFilename: UrlOrReference$2): Promise<Stats>;
224
223
  /**
225
- * Get Stats on a uri.
226
- * @param urlOrFilename - uri to fetch stats on
227
- * @returns Stats if successful, otherwise it throws an error.
228
- * @deprecated Use `getStat` instead.
229
- */
224
+ * Get Stats on a uri.
225
+ * @param urlOrFilename - uri to fetch stats on
226
+ * @returns Stats if successful, otherwise it throws an error.
227
+ * @deprecated Use `getStat` instead.
228
+ */
230
229
  getStatSync(urlOrFilename: UrlOrReference$2): Stats;
231
230
  /**
232
- * Compare two Stats.
233
- * @param left - left stat
234
- * @param right - right stat
235
- * @returns 0 if they are equal and non-zero if they are not.
236
- */
231
+ * Compare two Stats.
232
+ * @param left - left stat
233
+ * @param right - right stat
234
+ * @returns 0 if they are equal and non-zero if they are not.
235
+ */
237
236
  compareStats(left: Stats, right: Stats): number;
238
237
  /**
239
- * Convert a string to a URL
240
- * @param urlOrFilename - string or URL to convert.
241
- * If it is a URL, then it is just returned as is.
242
- * If is is a string and fully formed URL, then it is parsed.
243
- * If it is a string without a protocol/scheme it is assumed to be relative to `relativeTo`.
244
- * @param relativeTo - optional
245
- */
238
+ * Convert a string to a URL
239
+ * @param urlOrFilename - string or URL to convert.
240
+ * If it is a URL, then it is just returned as is.
241
+ * If is is a string and fully formed URL, then it is parsed.
242
+ * If it is a string without a protocol/scheme it is assumed to be relative to `relativeTo`.
243
+ * @param relativeTo - optional
244
+ */
246
245
  toURL(urlOrFilename: UrlOrReference$2, relativeTo?: string | URL): URL;
247
246
  /**
248
- * Convert a string to a File URL
249
- * @param urlOrFilename - string or URL to convert.
250
- * @param relativeTo - optional
251
- */
247
+ * Convert a string to a File URL
248
+ * @param urlOrFilename - string or URL to convert.
249
+ * @param relativeTo - optional
250
+ */
252
251
  toFileURL(urlOrFilename: UrlOrFilename, relativeTo?: string | URL): URL;
253
252
  /**
254
- * Try to determine the base name of a URL.
255
- *
256
- * Note: this handles `data:` URLs with `filename` attribute:
257
- *
258
- * Example:
259
- * - `data:text/plain;charset=utf8;filename=hello.txt,Hello` would have a filename of `hello.txt`
260
- * - `file:///user/project/cspell.config.yaml` would have a filename of `cspell.config.yaml`
261
- * - `https://raw.guc.com/sss/cspell/main/cspell.schema.json` would have a filename of `cspell.schema.json`
262
- * @param urlOrFilename - string or URL to extract the basename from.
263
- */
253
+ * Try to determine the base name of a URL.
254
+ *
255
+ * Note: this handles `data:` URLs with `filename` attribute:
256
+ *
257
+ * Example:
258
+ * - `data:text/plain;charset=utf8;filename=hello.txt,Hello` would have a filename of `hello.txt`
259
+ * - `file:///user/project/cspell.config.yaml` would have a filename of `cspell.config.yaml`
260
+ * - `https://raw.guc.com/sss/cspell/main/cspell.schema.json` would have a filename of `cspell.schema.json`
261
+ * @param urlOrFilename - string or URL to extract the basename from.
262
+ */
264
263
  urlBasename(urlOrFilename: UrlOrReference$2): string;
265
264
  /**
266
- * Try to determine the directory URL of the uri.
267
- *
268
- * Example:
269
- * - `file:///user/local/file.txt` becomes `file:///user/local/`
270
- * - `file:///user/local/` becomes `file:///user/`
271
- *
272
- * @param urlOrFilename - string or URL
273
- */
265
+ * Try to determine the directory URL of the uri.
266
+ *
267
+ * Example:
268
+ * - `file:///user/local/file.txt` becomes `file:///user/local/`
269
+ * - `file:///user/local/` becomes `file:///user/`
270
+ *
271
+ * @param urlOrFilename - string or URL
272
+ */
274
273
  urlDirname(urlOrFilename: UrlOrReference$2): URL;
275
274
  }
276
275
  //#endregion
@@ -311,15 +310,15 @@ type TArrayBufferView<T extends ArrayBuffer = ArrayBuffer> = ArrayBufferView<T>;
311
310
  //#endregion
312
311
  //#region src/node/dataUrl.d.ts
313
312
  /**
314
- * Generates a string of the following format:
315
- *
316
- * `data:[mediaType][;charset=<encoding>[;base64],<data>`
317
- *
318
- * - `encoding` - defaults to `utf8` for text data
319
- * @param data
320
- * @param mediaType - The mediaType is a [MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) type string
321
- * @param attributes - Additional attributes
322
- */
313
+ * Generates a string of the following format:
314
+ *
315
+ * `data:[mediaType][;charset=<encoding>[;base64],<data>`
316
+ *
317
+ * - `encoding` - defaults to `utf8` for text data
318
+ * @param data
319
+ * @param mediaType - The mediaType is a [MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) type string
320
+ * @param attributes - Additional attributes
321
+ */
323
322
  declare function encodeDataUrl(data: string | TArrayBufferView | Uint8Array<ArrayBuffer>, mediaType: string, attributes?: Iterable<readonly [string, string]> | undefined): string;
324
323
  declare function toDataUrl(data: string | TArrayBufferView, mediaType: string, attributes?: Iterable<[string, string]> | undefined): URL;
325
324
  //#endregion
@@ -347,49 +346,49 @@ interface ReadFileOptions {
347
346
  }
348
347
  interface VFileSystemCore {
349
348
  /**
350
- * Read a file.
351
- * @param url - URL to read
352
- * @param encoding - optional encoding
353
- * @returns A FileResource, the content will not be decoded. Use `.getText()` to get the decoded text.
354
- */
349
+ * Read a file.
350
+ * @param url - URL to read
351
+ * @param encoding - optional encoding
352
+ * @returns A FileResource, the content will not be decoded. Use `.getText()` to get the decoded text.
353
+ */
355
354
  readFile(url: UrlOrReference, encoding: BufferEncoding): Promise<TextFileResource>;
356
355
  /**
357
- * Read a file.
358
- * @param url - URL to read
359
- * @param options - options for reading the file.
360
- * @returns A FileResource, the content will not be decoded. Use `.getText()` to get the decoded text.
361
- */
356
+ * Read a file.
357
+ * @param url - URL to read
358
+ * @param options - options for reading the file.
359
+ * @returns A FileResource, the content will not be decoded. Use `.getText()` to get the decoded text.
360
+ */
362
361
  readFile(url: UrlOrReference, options?: ReadFileOptions | BufferEncoding): Promise<TextFileResource>;
363
362
  /**
364
- * Write a file
365
- * @param file - the file to write
366
- */
363
+ * Write a file
364
+ * @param file - the file to write
365
+ */
367
366
  writeFile(file: FileResource): Promise<FileReference>;
368
367
  /**
369
- * Get the stats for a url.
370
- * @param url - Url to fetch stats for.
371
- */
368
+ * Get the stats for a url.
369
+ * @param url - Url to fetch stats for.
370
+ */
372
371
  stat(url: UrlOrReference): Promise<VfsStat>;
373
372
  /**
374
- * Read the directory entries for a url.
375
- * The url should end with `/` to indicate a directory.
376
- * @param url - the url to read the directory entries for.
377
- */
373
+ * Read the directory entries for a url.
374
+ * The url should end with `/` to indicate a directory.
375
+ * @param url - the url to read the directory entries for.
376
+ */
378
377
  readDirectory(url: URL): Promise<VfsDirEntry[]>;
379
378
  /**
380
- * Get the capabilities for a URL.
381
- * The capabilities can be more restrictive than the general capabilities of the provider.
382
- * @param url - the url to try
383
- */
379
+ * Get the capabilities for a URL.
380
+ * The capabilities can be more restrictive than the general capabilities of the provider.
381
+ * @param url - the url to try
382
+ */
384
383
  getCapabilities(url: URL): Readonly<FSCapabilities>;
385
384
  /**
386
- * Information about the provider.
387
- * It is up to the provider to define what information is available.
388
- */
385
+ * Information about the provider.
386
+ * It is up to the provider to define what information is available.
387
+ */
389
388
  providerInfo: Readonly<FileSystemProviderInfo>;
390
389
  /**
391
- * Indicates that a provider was found for the url.
392
- */
390
+ * Indicates that a provider was found for the url.
391
+ */
393
392
  hasProvider: boolean;
394
393
  }
395
394
  interface VFileSystem extends VFileSystemCore {
@@ -427,24 +426,24 @@ type NextProvider = (url: URL) => VProviderFileSystem | undefined;
427
426
  interface VirtualFS extends DisposableEx {
428
427
  registerFileSystemProvider(provider: VFileSystemProvider, ...providers: VFileSystemProvider[]): DisposableEx;
429
428
  /**
430
- * Get the fs for a given url.
431
- */
429
+ * Get the fs for a given url.
430
+ */
432
431
  getFS(url: URL): VFileSystem;
433
432
  /**
434
- * The file system. All requests will first use getFileSystem to get the file system before making the request.
435
- */
433
+ * The file system. All requests will first use getFileSystem to get the file system before making the request.
434
+ */
436
435
  readonly fs: Required<VFileSystem>;
437
436
  /**
438
- * The file system core. All requests will first use getFileSystem to get the file system before making the request.
439
- */
437
+ * The file system core. All requests will first use getFileSystem to get the file system before making the request.
438
+ */
440
439
  readonly fsc: Required<VFileSystemCore>;
441
440
  /**
442
- * Clear the cache of file systems.
443
- */
441
+ * Clear the cache of file systems.
442
+ */
444
443
  reset(): void;
445
444
  /**
446
- * Indicates that logging has been enabled.
447
- */
445
+ * Indicates that logging has been enabled.
446
+ */
448
447
  loggingEnabled: boolean;
449
448
  enableLogging(value?: boolean): void;
450
449
  }
@@ -456,33 +455,33 @@ interface VProviderFileSystem extends DisposableEx {
456
455
  readFile(url: UrlOrReference, options?: VProviderFileSystemReadFileOptions): Promise<FileResource>;
457
456
  writeFile(file: FileResource): Promise<FileReference>;
458
457
  /**
459
- * Information about the provider.
460
- * It is up to the provider to define what information is available.
461
- */
458
+ * Information about the provider.
459
+ * It is up to the provider to define what information is available.
460
+ */
462
461
  providerInfo: FileSystemProviderInfo;
463
462
  stat(url: UrlOrReference): Stats | Promise<Stats>;
464
463
  readDirectory(url: URL): Promise<DirEntry[]>;
465
464
  /**
466
- * These are the general capabilities for the provider's file system.
467
- * It is possible for a provider to support more capabilities for a given url by providing a getCapabilities function.
468
- */
465
+ * These are the general capabilities for the provider's file system.
466
+ * It is possible for a provider to support more capabilities for a given url by providing a getCapabilities function.
467
+ */
469
468
  capabilities: FSCapabilityFlags;
470
469
  /**
471
- * Get the capabilities for a URL. Makes it possible for a provider to support more capabilities for a given url.
472
- * These capabilities should be more restrictive than the general capabilities.
473
- * @param url - the url to try
474
- * @returns the capabilities for the url.
475
- */
470
+ * Get the capabilities for a URL. Makes it possible for a provider to support more capabilities for a given url.
471
+ * These capabilities should be more restrictive than the general capabilities.
472
+ * @param url - the url to try
473
+ * @returns the capabilities for the url.
474
+ */
476
475
  getCapabilities?: (url: URL) => FSCapabilities;
477
476
  }
478
477
  interface VFileSystemProvider extends Partial<DisposableEx> {
479
478
  /** Name of the Provider */
480
479
  name: string;
481
480
  /**
482
- * Get the file system for a given url. The provider is cached based upon the protocol and hostname.
483
- * @param url - the url to get the file system for.
484
- * @param next - call this function to get the next provider to try. This is useful for chaining providers that operate on the same protocol.
485
- */
481
+ * Get the file system for a given url. The provider is cached based upon the protocol and hostname.
482
+ * @param url - the url to get the file system for.
483
+ * @param next - call this function to get the next provider to try. This is useful for chaining providers that operate on the same protocol.
484
+ */
486
485
  getFileSystem(url: URL, next: NextProvider): VProviderFileSystem | undefined;
487
486
  }
488
487
  //#endregion
@@ -493,31 +492,31 @@ declare function getDefaultVirtualFs(): VirtualFS;
493
492
  //#region src/VirtualFS/redirectProvider.d.ts
494
493
  interface RedirectOptions {
495
494
  /**
496
- * Option ts to mask the capabilities of the provider.
497
- * @default: -1
498
- */
495
+ * Option ts to mask the capabilities of the provider.
496
+ * @default: -1
497
+ */
499
498
  capabilitiesMask?: number;
500
499
  capabilities?: FSCapabilityFlags;
501
500
  }
502
501
  /**
503
- * Create a provider that will redirect requests from the publicRoot to the privateRoot.
504
- * This is useful for creating a virtual file system that is a subset of another file system.
505
- *
506
- * Example:
507
- * ```ts
508
- * const vfs = createVirtualFS();
509
- * const provider = createRedirectProvider('test', new URL('file:///public/'), new URL('file:///private/'))
510
- * vfs.registerFileSystemProvider(provider);
511
- * // Read the content of `file:///private/file.txt`
512
- * const file = vfs.fs.readFile(new URL('file:///public/file.txt');
513
- * ```
514
- *
515
- * @param name - name of the provider
516
- * @param publicRoot - the root of the public file system.
517
- * @param privateRoot - the root of the private file system.
518
- * @param options - options for the provider.
519
- * @returns FileSystemProvider
520
- */
502
+ * Create a provider that will redirect requests from the publicRoot to the privateRoot.
503
+ * This is useful for creating a virtual file system that is a subset of another file system.
504
+ *
505
+ * Example:
506
+ * ```ts
507
+ * const vfs = createVirtualFS();
508
+ * const provider = createRedirectProvider('test', new URL('file:///public/'), new URL('file:///private/'))
509
+ * vfs.registerFileSystemProvider(provider);
510
+ * // Read the content of `file:///private/file.txt`
511
+ * const file = vfs.fs.readFile(new URL('file:///public/file.txt');
512
+ * ```
513
+ *
514
+ * @param name - name of the provider
515
+ * @param publicRoot - the root of the public file system.
516
+ * @param privateRoot - the root of the private file system.
517
+ * @param options - options for the provider.
518
+ * @returns FileSystemProvider
519
+ */
521
520
  declare function createRedirectProvider(name: string, publicRoot: URL, privateRoot: URL, options?: RedirectOptions): VFileSystemProvider;
522
521
  //#endregion
523
522
  export { type BufferEncoding, CFileReference, CFileResource, CSPELL_VFS_PROTOCOL, type CSpellIO, CSpellIONode, FSCapabilityFlags, type FileReference, type FileResource, type Stats, type TextEncoding, type TextFileResource, type VFileSystem, type VFileSystemCore, type VFileSystemProvider, FileType as VFileType, type VFindEntryType, type VFindUpPredicate, type VFindUpURLOptions, type VProviderFileSystem, type VfsDirEntry, type VfsStat, type VirtualFS, toArray as asyncIterableToArray, compareStats, createRedirectProvider, fromFileResource as createTextFileResource, createVirtualFS, encodeDataUrl, getDefaultCSpellIO, getDefaultVirtualFs, getStat, getStatSync, isFileURL, isUrlLike, readFileText, readFileTextSync, renameFileReference, renameFileResource, toDataUrl, toFileURL, toURL, urlBasename, urlDirname, urlOrReferenceToUrl, writeToFile, writeToFileIterable, writeToFileIterable as writeToFileIterableP };
package/dist/index.js CHANGED
@@ -219,7 +219,8 @@ function isGZipped(data) {
219
219
  }
220
220
  function decompressBuffer(data) {
221
221
  if (!isGZipped(data)) return data;
222
- return gunzipSync(arrayBufferViewToBuffer(data));
222
+ const buf = arrayBufferViewToBuffer(data);
223
+ return gunzipSync(buf);
223
224
  }
224
225
  async function decompress(data, method = "gzip") {
225
226
  const ds = new DecompressionStream(method || "deflate-raw");
@@ -518,7 +519,8 @@ async function fetchHead(request) {
518
519
  }
519
520
  async function fetchURL(url, signal) {
520
521
  try {
521
- const response = await _fetch(signal ? new Request(url, { signal }) : url);
522
+ const request = signal ? new Request(url, { signal }) : url;
523
+ const response = await _fetch(request);
522
524
  if (!response.ok) throw FetchUrlError.create(url, response.status);
523
525
  return await response.bytes();
524
526
  } catch (e) {
@@ -852,7 +854,9 @@ function writeToFile(filename, data, encoding) {
852
854
  return writeToFileIterable(filename, typeof data === "string" ? [data] : data, encoding);
853
855
  }
854
856
  function writeToFileIterable(filename, data, encoding) {
855
- return pipeline(Stream.Readable.from(encoderTransformer(data, encoding)), /\.gz$/.test(filename) ? zlib.createGzip() : new Stream.PassThrough(), fs.createWriteStream(filename));
857
+ const stream = Stream.Readable.from(encoderTransformer(data, encoding));
858
+ const zip = /\.gz$/.test(filename) ? zlib.createGzip() : new Stream.PassThrough();
859
+ return pipeline(stream, zip, fs.createWriteStream(filename));
856
860
  }
857
861
  //#endregion
858
862
  //#region src/file/file.ts
@@ -1165,7 +1169,7 @@ function cspellIOToFsProvider(cspellIO) {
1165
1169
  "https:": capabilitiesHttp
1166
1170
  };
1167
1171
  const name = "CSpellIO";
1168
- const supportedProtocols = new Set([
1172
+ const supportedProtocols = /* @__PURE__ */ new Set([
1169
1173
  "file:",
1170
1174
  "http:",
1171
1175
  "https:"
@@ -1558,7 +1562,8 @@ function remapFS(name, fs, shadowFs, publicRoot, privateRoot, options) {
1558
1562
  },
1559
1563
  readFile: async (url, options) => {
1560
1564
  const url2 = mapUrlOrReferenceToPrivate(url);
1561
- return mapFileResourceToPublic(await fs.readFile(url2, options));
1565
+ const file = await fs.readFile(url2, options);
1566
+ return mapFileResourceToPublic(file);
1562
1567
  },
1563
1568
  readDirectory: async (url) => {
1564
1569
  const url2 = mapToPrivate(url);
@@ -1566,7 +1571,8 @@ function remapFS(name, fs, shadowFs, publicRoot, privateRoot, options) {
1566
1571
  },
1567
1572
  writeFile: async (file) => {
1568
1573
  const fileRef2 = mapFileResourceToPrivate(file);
1569
- return mapFileReferenceToPublic(await fs.writeFile(fileRef2));
1574
+ const fileRef3 = await fs.writeFile(fileRef2);
1575
+ return mapFileReferenceToPublic(fileRef3);
1570
1576
  },
1571
1577
  providerInfo: {
1572
1578
  ...fs.providerInfo,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "10.0.1",
7
+ "version": "10.1.1",
8
8
  "description": "A library of useful I/O functions used across various cspell tools.",
9
9
  "type": "module",
10
10
  "sideEffects": false,
@@ -51,13 +51,13 @@
51
51
  "node": ">=22.18.0"
52
52
  },
53
53
  "devDependencies": {
54
- "lorem-ipsum": "^2.0.10",
55
- "typescript": "~5.9.3",
54
+ "lorem-ipsum": "^3.0.0",
55
+ "typescript": "~6.0.3",
56
56
  "vitest-fetch-mock": "^0.4.5"
57
57
  },
58
58
  "dependencies": {
59
- "@cspell/cspell-service-bus": "10.0.1",
60
- "@cspell/url": "10.0.1"
59
+ "@cspell/cspell-service-bus": "10.1.1",
60
+ "@cspell/url": "10.1.1"
61
61
  },
62
- "gitHead": "0f43abf29e5da0ecbcb08214055cdc1e3267c3ea"
62
+ "gitHead": "bc3bc22aa1aa1b3073768f2ac9cf0d9a06f65177"
63
63
  }