cspell-io 10.3.6 → 10.4.0
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 +22 -23
- package/dist/index.js +6 -4
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isFileURL, isUrlLike, toFileURL, toURL, urlBasename, urlParent as urlDirname } from "@cspell/url";
|
|
2
|
-
import { Buffer } from "node:buffer";
|
|
3
2
|
import { ServiceBus } from "@cspell/cspell-service-bus";
|
|
4
3
|
//#region src/async/asyncIterable.d.ts
|
|
5
4
|
/**
|
|
@@ -68,7 +67,7 @@ interface CFileReferenceJson {
|
|
|
68
67
|
baseFilename?: string | undefined;
|
|
69
68
|
gz?: boolean | undefined;
|
|
70
69
|
}
|
|
71
|
-
declare class CFileReference implements FileReference {
|
|
70
|
+
export declare class CFileReference implements FileReference {
|
|
72
71
|
readonly url: URL;
|
|
73
72
|
readonly encoding: BufferEncoding | undefined;
|
|
74
73
|
readonly baseFilename: string | undefined;
|
|
@@ -84,7 +83,7 @@ declare class CFileReference implements FileReference {
|
|
|
84
83
|
static from(url: URL, encoding?: BufferEncoding, baseFilename?: string | undefined, gz?: boolean | undefined): CFileReference;
|
|
85
84
|
toJson(): CFileReferenceJson;
|
|
86
85
|
}
|
|
87
|
-
declare function renameFileReference(ref: FileReference, newUrl: URL): FileReference;
|
|
86
|
+
export declare function renameFileReference(ref: FileReference, newUrl: URL): FileReference;
|
|
88
87
|
//#endregion
|
|
89
88
|
//#region src/common/CFileResource.d.ts
|
|
90
89
|
interface CFileResourceJson {
|
|
@@ -94,7 +93,7 @@ interface CFileResourceJson {
|
|
|
94
93
|
baseFilename?: string | undefined;
|
|
95
94
|
gz: boolean;
|
|
96
95
|
}
|
|
97
|
-
declare class CFileResource implements TextFileResource {
|
|
96
|
+
export declare class CFileResource implements TextFileResource {
|
|
98
97
|
#private;
|
|
99
98
|
readonly baseFilename?: string | undefined;
|
|
100
99
|
readonly url: URL;
|
|
@@ -112,7 +111,7 @@ declare class CFileResource implements TextFileResource {
|
|
|
112
111
|
static from(url: URL, content: string | Uint8Array<ArrayBuffer>, encoding?: BufferEncoding | undefined, baseFilename?: string | undefined, gz?: boolean): CFileResource;
|
|
113
112
|
}
|
|
114
113
|
declare function fromFileResource(fileResource: FileResource, encoding?: BufferEncoding): TextFileResource;
|
|
115
|
-
declare function renameFileResource(fileResource: FileResource, url: URL): FileResource;
|
|
114
|
+
export declare function renameFileResource(fileResource: FileResource, url: URL): FileResource;
|
|
116
115
|
//#endregion
|
|
117
116
|
//#region src/models/Stats.d.ts
|
|
118
117
|
/**
|
|
@@ -167,7 +166,7 @@ interface DirEntry {
|
|
|
167
166
|
* @param right - Stats
|
|
168
167
|
* @returns 0 - equal; 1 - left > right; -1 left < right
|
|
169
168
|
*/
|
|
170
|
-
declare function compareStats(left: Stats, right: Stats): number;
|
|
169
|
+
export declare function compareStats(left: Stats, right: Stats): number;
|
|
171
170
|
//#endregion
|
|
172
171
|
//#region src/models/disposable.d.ts
|
|
173
172
|
type DisposableEx = LegacyDisposable & Disposable;
|
|
@@ -177,7 +176,7 @@ interface LegacyDisposable {
|
|
|
177
176
|
//#endregion
|
|
178
177
|
//#region src/common/urlOrReferenceToUrl.d.ts
|
|
179
178
|
type UrlOrReference$1 = URL | FileReference;
|
|
180
|
-
declare function urlOrReferenceToUrl(urlOrReference: UrlOrReference$1): URL;
|
|
179
|
+
export declare function urlOrReferenceToUrl(urlOrReference: UrlOrReference$1): URL;
|
|
181
180
|
//#endregion
|
|
182
181
|
//#region src/CSpellIO.d.ts
|
|
183
182
|
interface ReadFileOptions$1 {
|
|
@@ -274,7 +273,7 @@ interface CSpellIO {
|
|
|
274
273
|
}
|
|
275
274
|
//#endregion
|
|
276
275
|
//#region src/CSpellIONode.d.ts
|
|
277
|
-
declare class CSpellIONode implements CSpellIO {
|
|
276
|
+
export declare class CSpellIONode implements CSpellIO {
|
|
278
277
|
readonly serviceBus: ServiceBus;
|
|
279
278
|
constructor(serviceBus?: ServiceBus);
|
|
280
279
|
readFile(urlOrFilename: UrlOrReference$2, options?: ReadFileOptionsOrEncoding): Promise<TextFileResource>;
|
|
@@ -289,21 +288,21 @@ declare class CSpellIONode implements CSpellIO {
|
|
|
289
288
|
urlBasename(urlOrFilename: UrlOrReference$2): string;
|
|
290
289
|
urlDirname(urlOrFilename: UrlOrReference$2): URL;
|
|
291
290
|
}
|
|
292
|
-
declare function getDefaultCSpellIO(): CSpellIO;
|
|
291
|
+
export declare function getDefaultCSpellIO(): CSpellIO;
|
|
293
292
|
//#endregion
|
|
294
293
|
//#region src/common/BufferEncoding.d.ts
|
|
295
294
|
type TextEncodingExtra = "utf-16be" | "utf-16le" | "utf16be" | "utf16le";
|
|
296
295
|
type BufferEncodingExt = BufferEncoding | TextEncodingExtra;
|
|
297
296
|
//#endregion
|
|
298
297
|
//#region src/node/file/fileWriter.d.ts
|
|
299
|
-
declare function writeToFile(filename: string, data: string | Iterable<string> | AsyncIterable<string>, encoding?: BufferEncoding): Promise<void>;
|
|
300
|
-
declare function writeToFileIterable(filename: string, data: Iterable<string> | AsyncIterable<string>, encoding?: BufferEncodingExt): Promise<void>;
|
|
298
|
+
export declare function writeToFile(filename: string, data: string | Iterable<string> | AsyncIterable<string>, encoding?: BufferEncoding): Promise<void>;
|
|
299
|
+
export declare function writeToFileIterable(filename: string, data: Iterable<string> | AsyncIterable<string>, encoding?: BufferEncodingExt): Promise<void>;
|
|
301
300
|
//#endregion
|
|
302
301
|
//#region src/file/file.d.ts
|
|
303
|
-
declare function readFileText(filename: string | URL, encoding?: BufferEncoding): Promise<string>;
|
|
304
|
-
declare function readFileTextSync(filename: string | URL, encoding?: BufferEncoding): string;
|
|
305
|
-
declare function getStat(filenameOrUri: string): Promise<Stats | Error>;
|
|
306
|
-
declare function getStatSync(filenameOrUri: string): Stats | Error;
|
|
302
|
+
export declare function readFileText(filename: string | URL, encoding?: BufferEncoding): Promise<string>;
|
|
303
|
+
export declare function readFileTextSync(filename: string | URL, encoding?: BufferEncoding): string;
|
|
304
|
+
export declare function getStat(filenameOrUri: string): Promise<Stats | Error>;
|
|
305
|
+
export declare function getStatSync(filenameOrUri: string): Stats | Error;
|
|
307
306
|
//#endregion
|
|
308
307
|
//#region src/types.d.ts
|
|
309
308
|
type TArrayBufferView<T extends ArrayBuffer = ArrayBuffer> = ArrayBufferView<T>;
|
|
@@ -319,15 +318,15 @@ type TArrayBufferView<T extends ArrayBuffer = ArrayBuffer> = ArrayBufferView<T>;
|
|
|
319
318
|
* @param mediaType - The mediaType is a [MIME](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) type string
|
|
320
319
|
* @param attributes - Additional attributes
|
|
321
320
|
*/
|
|
322
|
-
declare function encodeDataUrl(data: string | TArrayBufferView | Uint8Array<ArrayBuffer>, mediaType: string, attributes?: Iterable<readonly [string, string]> | undefined): string;
|
|
323
|
-
declare function toDataUrl(data: string | TArrayBufferView, mediaType: string, attributes?: Iterable<[string, string]> | undefined): URL;
|
|
321
|
+
export declare function encodeDataUrl(data: string | TArrayBufferView | Uint8Array<ArrayBuffer>, mediaType: string, attributes?: Iterable<readonly [string, string]> | undefined): string;
|
|
322
|
+
export declare function toDataUrl(data: string | TArrayBufferView, mediaType: string, attributes?: Iterable<[string, string]> | undefined): URL;
|
|
324
323
|
//#endregion
|
|
325
324
|
//#region src/VirtualFS/constants.d.ts
|
|
326
|
-
declare const CSPELL_VFS_PROTOCOL: "cspell-vfs:";
|
|
325
|
+
export declare const CSPELL_VFS_PROTOCOL: "cspell-vfs:";
|
|
327
326
|
//#endregion
|
|
328
327
|
//#region src/VirtualFS/VFileSystem.d.ts
|
|
329
328
|
type UrlOrReference = URL | FileReference;
|
|
330
|
-
declare enum FSCapabilityFlags {
|
|
329
|
+
export declare enum FSCapabilityFlags {
|
|
331
330
|
None = 0,
|
|
332
331
|
Stat = 1,
|
|
333
332
|
Read = 2,
|
|
@@ -486,8 +485,8 @@ interface VFileSystemProvider extends Partial<DisposableEx> {
|
|
|
486
485
|
}
|
|
487
486
|
//#endregion
|
|
488
487
|
//#region src/VirtualFS/CVirtualFS.d.ts
|
|
489
|
-
declare function createVirtualFS(cspellIO?: CSpellIO): VirtualFS;
|
|
490
|
-
declare function getDefaultVirtualFs(): VirtualFS;
|
|
488
|
+
export declare function createVirtualFS(cspellIO?: CSpellIO): VirtualFS;
|
|
489
|
+
export declare function getDefaultVirtualFs(): VirtualFS;
|
|
491
490
|
//#endregion
|
|
492
491
|
//#region src/VirtualFS/redirectProvider.d.ts
|
|
493
492
|
interface RedirectOptions {
|
|
@@ -520,7 +519,7 @@ interface RedirectOptions {
|
|
|
520
519
|
* @param options - options for the provider.
|
|
521
520
|
* @returns FileSystemProvider
|
|
522
521
|
*/
|
|
523
|
-
declare function createRedirectProvider(name: string, publicRoot: URL, privateRoot: URL, options?: RedirectOptions): VFileSystemProvider;
|
|
522
|
+
export declare function createRedirectProvider(name: string, publicRoot: URL, privateRoot: URL, options?: RedirectOptions): VFileSystemProvider;
|
|
524
523
|
//#endregion
|
|
525
|
-
export { type BufferEncoding,
|
|
524
|
+
export { type BufferEncoding, type CSpellIO, 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, fromFileResource as createTextFileResource, isFileURL, isUrlLike, toFileURL, toURL, urlBasename, urlDirname, writeToFileIterable as writeToFileIterableP };
|
|
526
525
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -108,15 +108,17 @@ function assert$1(value, message) {
|
|
|
108
108
|
if (!value) throw new AssertionError(message ?? "Assertion failed");
|
|
109
109
|
}
|
|
110
110
|
//#endregion
|
|
111
|
+
//#region src/common/nodeBuffer.ts
|
|
112
|
+
function arrayBufferViewToBuffer(data) {
|
|
113
|
+
if (data instanceof Buffer) return data;
|
|
114
|
+
return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
111
117
|
//#region src/common/arrayBuffers.ts
|
|
112
118
|
function toUint8Array(data) {
|
|
113
119
|
if (data instanceof Uint8Array) return data;
|
|
114
120
|
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
115
121
|
}
|
|
116
|
-
function arrayBufferViewToBuffer(data) {
|
|
117
|
-
if (data instanceof Buffer) return data;
|
|
118
|
-
return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
119
|
-
}
|
|
120
122
|
function copyArrayBufferView(data) {
|
|
121
123
|
return new Uint8Array(data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength));
|
|
122
124
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-io",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.4.0",
|
|
4
4
|
"description": "A library of useful I/O functions used across various cspell tools.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"watch": "pnpm build:watch"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-service-bus": "10.
|
|
52
|
-
"@cspell/url": "10.
|
|
51
|
+
"@cspell/cspell-service-bus": "10.4.0",
|
|
52
|
+
"@cspell/url": "10.4.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"lorem-ipsum": "^3.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=22.18.0"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "7e2bbb5e866c827ac5d2cf6b84bf3e1a016d0823"
|
|
63
63
|
}
|