cspell-io
Advanced tools
+2
-2
@@ -156,3 +156,3 @@ import { isFileURL, isUrlLike, toFileURL, toURL, urlBasename, urlParent as urlDirname } from "@cspell/url"; | ||
| */ | ||
| SymbolicLink = 64, | ||
| SymbolicLink = 64 | ||
| } | ||
@@ -305,3 +305,3 @@ interface DirEntry { | ||
| WriteDir = 16, | ||
| ReadWriteDir = 24, | ||
| ReadWriteDir = 24 | ||
| } | ||
@@ -308,0 +308,0 @@ interface FileSystemProviderInfo { |
+63
-63
@@ -303,4 +303,4 @@ import { isFileURL, isUrlLike, toFileURL, toURL, urlBasename, urlParent as urlDirname } from "@cspell/url"; | ||
| if (content) { | ||
| const { url, encoding: encoding$1, baseFilename: baseFilename$1, gz: gz$1 } = urlOrFileResource; | ||
| return new CFileResource(url, content, encoding$1, baseFilename$1, gz$1); | ||
| const { url, encoding, baseFilename, gz } = urlOrFileResource; | ||
| return new CFileResource(url, content, encoding, baseFilename, gz); | ||
| } | ||
@@ -374,20 +374,20 @@ return urlOrFileResource; | ||
| //#region src/models/Stats.ts | ||
| let FileType = /* @__PURE__ */ function(FileType$1) { | ||
| let FileType = /* @__PURE__ */ function(FileType) { | ||
| /** | ||
| * The file type is unknown. | ||
| */ | ||
| FileType$1[FileType$1["Unknown"] = 0] = "Unknown"; | ||
| FileType[FileType["Unknown"] = 0] = "Unknown"; | ||
| /** | ||
| * A regular file. | ||
| */ | ||
| FileType$1[FileType$1["File"] = 1] = "File"; | ||
| FileType[FileType["File"] = 1] = "File"; | ||
| /** | ||
| * A directory. | ||
| */ | ||
| FileType$1[FileType$1["Directory"] = 2] = "Directory"; | ||
| FileType[FileType["Directory"] = 2] = "Directory"; | ||
| /** | ||
| * A symbolic link. | ||
| */ | ||
| FileType$1[FileType$1["SymbolicLink"] = 64] = "SymbolicLink"; | ||
| return FileType$1; | ||
| FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink"; | ||
| return FileType; | ||
| }({}); | ||
@@ -871,6 +871,6 @@ | ||
| async function findUpFromUrl(name, from, options) { | ||
| const { type: entryType = "file", stopAt, fs: fs$1 } = options; | ||
| const { type: entryType = "file", stopAt, fs } = options; | ||
| let dir = new URL(".", from); | ||
| const root = new URL("/", dir); | ||
| const predicate = makePredicate(fs$1, name, entryType); | ||
| const predicate = makePredicate(fs, name, entryType); | ||
| const stopAtHrefs = new Set((Array.isArray(stopAt) ? stopAt : [stopAt || root]).map((p) => new URL(".", p).href)); | ||
@@ -886,9 +886,9 @@ let last = ""; | ||
| } | ||
| function makePredicate(fs$1, name, entryType) { | ||
| function makePredicate(fs, name, entryType) { | ||
| if (typeof name === "function") return name; | ||
| const checkStat = entryType === "file" || entryType === "!file" ? "isFile" : "isDirectory"; | ||
| const checkValue = entryType.startsWith("!") ? false : true; | ||
| function checkName(dir, name$1) { | ||
| const f = new URL(name$1, dir); | ||
| return fs$1.stat(f).then((stats) => (stats.isUnknown() || stats[checkStat]() === checkValue) && f || void 0).catch(() => void 0); | ||
| function checkName(dir, name) { | ||
| const f = new URL(name, dir); | ||
| return fs.stat(f).then((stats) => (stats.isUnknown() || stats[checkStat]() === checkValue) && f || void 0).catch(() => void 0); | ||
| } | ||
@@ -938,12 +938,12 @@ if (!Array.isArray(name)) return (dir) => checkName(dir, name); | ||
| //#region src/VFileSystem.ts | ||
| let FSCapabilityFlags = /* @__PURE__ */ function(FSCapabilityFlags$1) { | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["None"] = 0] = "None"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["Stat"] = 1] = "Stat"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["Read"] = 2] = "Read"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["Write"] = 4] = "Write"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["ReadWrite"] = 6] = "ReadWrite"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["ReadDir"] = 8] = "ReadDir"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["WriteDir"] = 16] = "WriteDir"; | ||
| FSCapabilityFlags$1[FSCapabilityFlags$1["ReadWriteDir"] = 24] = "ReadWriteDir"; | ||
| return FSCapabilityFlags$1; | ||
| let FSCapabilityFlags = /* @__PURE__ */ function(FSCapabilityFlags) { | ||
| FSCapabilityFlags[FSCapabilityFlags["None"] = 0] = "None"; | ||
| FSCapabilityFlags[FSCapabilityFlags["Stat"] = 1] = "Stat"; | ||
| FSCapabilityFlags[FSCapabilityFlags["Read"] = 2] = "Read"; | ||
| FSCapabilityFlags[FSCapabilityFlags["Write"] = 4] = "Write"; | ||
| FSCapabilityFlags[FSCapabilityFlags["ReadWrite"] = 6] = "ReadWrite"; | ||
| FSCapabilityFlags[FSCapabilityFlags["ReadDir"] = 8] = "ReadDir"; | ||
| FSCapabilityFlags[FSCapabilityFlags["WriteDir"] = 16] = "WriteDir"; | ||
| FSCapabilityFlags[FSCapabilityFlags["ReadWriteDir"] = 24] = "ReadWriteDir"; | ||
| return FSCapabilityFlags; | ||
| }({}); | ||
@@ -967,3 +967,3 @@ | ||
| ]); | ||
| const fs$1 = { | ||
| const fs = { | ||
| providerInfo: { name }, | ||
@@ -983,3 +983,3 @@ stat: (url) => cspellIO.getStat(url), | ||
| getFileSystem: (url, _next) => { | ||
| return supportedProtocols.has(url.protocol) ? fs$1 : void 0; | ||
| return supportedProtocols.has(url.protocol) ? fs : void 0; | ||
| } | ||
@@ -1034,9 +1034,9 @@ }; | ||
| _capabilities; | ||
| constructor(fs$1, eventLogger) { | ||
| this.fs = fs$1; | ||
| constructor(fs, eventLogger) { | ||
| this.fs = fs; | ||
| this.eventLogger = eventLogger; | ||
| this.hasProvider = !!fs$1; | ||
| this.capabilities = fs$1?.capabilities || FSCapabilityFlags.None; | ||
| this.hasProvider = !!fs; | ||
| this.capabilities = fs?.capabilities || FSCapabilityFlags.None; | ||
| this._capabilities = fsCapabilities(this.capabilities); | ||
| this.providerInfo = fs$1?.providerInfo || { name: "unknown" }; | ||
| this.providerInfo = fs?.providerInfo || { name: "unknown" }; | ||
| } | ||
@@ -1113,7 +1113,7 @@ logEvent(method, event, traceID, url, message) { | ||
| } | ||
| static disposeOf(fs$1) { | ||
| fs$1 instanceof WrappedProviderFs && fs$1.fs?.dispose(); | ||
| static disposeOf(fs) { | ||
| fs instanceof WrappedProviderFs && fs.fs?.dispose(); | ||
| } | ||
| }; | ||
| function checkCapabilityOrThrow(fs$1, capabilities, flag, name, url) { | ||
| function checkCapabilityOrThrow(fs, capabilities, flag, name, url) { | ||
| if (!(capabilities & flag)) throw new VFSErrorUnsupportedRequest(name, url); | ||
@@ -1239,16 +1239,16 @@ } | ||
| if (cached) return cached; | ||
| const fnNext = (provider, next$1) => { | ||
| return (url$1) => { | ||
| const fnNext = (provider, next) => { | ||
| return (url) => { | ||
| let calledNext = false; | ||
| const fs$2 = provider.getFileSystem(url$1, (_url) => { | ||
| calledNext = calledNext || url$1 === _url; | ||
| return next$1(_url); | ||
| const fs = provider.getFileSystem(url, (_url) => { | ||
| calledNext = calledNext || url === _url; | ||
| return next(_url); | ||
| }); | ||
| if (fs$2) { | ||
| if (fs) { | ||
| const s = this.revCacheFs.get(provider) || /* @__PURE__ */ new Set(); | ||
| s.add(key); | ||
| this.revCacheFs.set(provider, s); | ||
| return fs$2; | ||
| return fs; | ||
| } | ||
| if (!calledNext) return next$1(url$1); | ||
| if (!calledNext) return next(url); | ||
| }; | ||
@@ -1258,5 +1258,5 @@ }; | ||
| for (const provider of this.providers) next = fnNext(provider, next); | ||
| const fs$1 = new WrappedProviderFs(next(url), this.logEvent); | ||
| this.cachedFs.set(key, fs$1); | ||
| return fs$1; | ||
| const fs = new WrappedProviderFs(next(url), this.logEvent); | ||
| this.cachedFs.set(key, fs); | ||
| return fs; | ||
| } | ||
@@ -1267,5 +1267,5 @@ reset() { | ||
| disposeOfCachedFs() { | ||
| for (const [key, fs$1] of [...this.cachedFs].reverse()) { | ||
| for (const [key, fs] of [...this.cachedFs].reverse()) { | ||
| try { | ||
| WrappedProviderFs.disposeOf(fs$1); | ||
| WrappedProviderFs.disposeOf(fs); | ||
| } catch {} | ||
@@ -1285,6 +1285,6 @@ this.cachedFs.delete(key); | ||
| }; | ||
| function fsPassThroughCore(fs$1) { | ||
| function fsPassThroughCore(fs) { | ||
| function gfs(ur, name) { | ||
| const url = urlOrReferenceToUrl(ur); | ||
| const f = fs$1(url); | ||
| const f = fs(url); | ||
| if (!f.hasProvider) throw new VFSErrorUnsupportedRequest(name, url, ur instanceof URL ? void 0 : { | ||
@@ -1425,3 +1425,3 @@ url: ur.url.toString(), | ||
| */ | ||
| function remapFS(name, fs$1, shadowFs, publicRoot, privateRoot, options) { | ||
| function remapFS(name, fs, shadowFs, publicRoot, privateRoot, options) { | ||
| const { capabilitiesMask = -1, capabilities } = options; | ||
@@ -1461,28 +1461,28 @@ function mapToPrivate(url) { | ||
| const url2 = mapUrlOrReferenceToPrivate(url); | ||
| return await fs$1.stat(url2); | ||
| return await fs.stat(url2); | ||
| }, | ||
| readFile: async (url, options$1) => { | ||
| readFile: async (url, options) => { | ||
| const url2 = mapUrlOrReferenceToPrivate(url); | ||
| return mapFileResourceToPublic(await fs$1.readFile(url2, options$1)); | ||
| return mapFileResourceToPublic(await fs.readFile(url2, options)); | ||
| }, | ||
| readDirectory: async (url) => { | ||
| const url2 = mapToPrivate(url); | ||
| return (await fs$1.readDirectory(url2)).map(mapDirEntryToPublic); | ||
| return (await fs.readDirectory(url2)).map(mapDirEntryToPublic); | ||
| }, | ||
| writeFile: async (file) => { | ||
| const fileRef2 = mapFileResourceToPrivate(file); | ||
| return mapFileReferenceToPublic(await fs$1.writeFile(fileRef2)); | ||
| return mapFileReferenceToPublic(await fs.writeFile(fileRef2)); | ||
| }, | ||
| providerInfo: { | ||
| ...fs$1.providerInfo, | ||
| ...fs.providerInfo, | ||
| name | ||
| }, | ||
| capabilities: capabilities ?? fs$1.capabilities & capabilitiesMask, | ||
| dispose: () => fs$1.dispose() | ||
| capabilities: capabilities ?? fs.capabilities & capabilitiesMask, | ||
| dispose: () => fs.dispose() | ||
| }, shadowFs, publicRoot); | ||
| } | ||
| function fsPassThrough(fs$1, shadowFs, root) { | ||
| function fsPassThrough(fs, shadowFs, root) { | ||
| function gfs(ur, name) { | ||
| const url = urlOrReferenceToUrl(ur); | ||
| const f = url.href.startsWith(root.href) ? fs$1 : shadowFs; | ||
| const f = url.href.startsWith(root.href) ? fs : shadowFs; | ||
| if (!f) throw new VFSErrorUnsupportedRequest(name, url, ur instanceof URL ? void 0 : { | ||
@@ -1496,6 +1496,6 @@ url: ur.url.toString(), | ||
| get providerInfo() { | ||
| return fs$1.providerInfo; | ||
| return fs.providerInfo; | ||
| }, | ||
| get capabilities() { | ||
| return fs$1.capabilities; | ||
| return fs.capabilities; | ||
| }, | ||
@@ -1511,3 +1511,3 @@ stat: async (url) => gfs(url, "stat").stat(url), | ||
| dispose: () => { | ||
| fs$1.dispose(); | ||
| fs.dispose(); | ||
| shadowFs?.dispose(); | ||
@@ -1514,0 +1514,0 @@ } |
+4
-4
@@ -7,3 +7,3 @@ { | ||
| }, | ||
| "version": "9.6.2", | ||
| "version": "9.6.3", | ||
| "description": "A library of useful I/O functions used across various cspell tools.", | ||
@@ -60,6 +60,6 @@ "type": "module", | ||
| "dependencies": { | ||
| "@cspell/cspell-service-bus": "9.6.2", | ||
| "@cspell/url": "9.6.2" | ||
| "@cspell/cspell-service-bus": "9.6.3", | ||
| "@cspell/url": "9.6.3" | ||
| }, | ||
| "gitHead": "646e18a04ff36d43f78a74e5055540e0f5297e91" | ||
| "gitHead": "500b996b6c0a6ff025c42ef98db44776f43a9e72" | ||
| } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
71230
-0.28%+ Added
+ Added
- Removed
- Removed
Updated