public SourceMap Build(string subtractDir, string srcRoot) { var sources = new List <string>((int)_sources.Count); foreach (var s in _sources) { sources.Add(PathUtils.Subtract(s, subtractDir)); } return(new SourceMap(sources) { sourceRoot = srcRoot, mappings = new string(_mappings.AsSpan()) }); }
public SourceMap Build(string subtractDir, string srcRoot) { var sources = new List <string>((int)_sources.Count); foreach (var s in _sources) { sources.Add(PathUtils.Subtract(s, subtractDir)); } var sourcesContent = _sourcesContent.All(s => s == null)? null: _sourcesContent.ToList(); return(new(sources) { sourceRoot = srcRoot, mappings = new(_mappings.AsSpan()), sourcesContent = sourcesContent });
public string Content() { return(new string(_content.AsSpan())); }
public override string ToString() { return(new string(_storage.AsSpan())); }
public long CalcIndex() { return(_rootNode._impl.CalcIndex(_stack.AsSpan())); }
public TSProject ResolveModule(string name) { if (Result.Modules.TryGetValue(name, out var module)) { if (module.IterationId == IterationId) { return(module.Valid ? module : null); } for (uint i = 0; i < module.NegativeChecks.Count; i++) { if (CheckItemExistence(module.NegativeChecks[i])) { goto again; } } if (module.Valid) { module.LoadProjectJson(true); if (module.PackageJsonChangeId == -1) { goto again; } } module.IterationId = IterationId; return(module.Valid ? module : null); } again :; var negativeChecks = new StructList <string>(); var dir = Owner.Owner.FullPath; while (dir.Length > 0) { var dc = Owner.DiskCache.TryGetItem(dir + "/node_modules/" + name) as IDirectoryCache; if (dc == null || dc.IsInvalid) { negativeChecks.Add(dir + "/node_modules/" + name); } else { if (dc.FullPath != dir + "/node_modules/" + name) { // Create it with proper casing return(ResolveModule(dc.Name)); } module = TSProject.Create(dc, Owner.DiskCache, Owner.Logger, dc.Name); module.LoadProjectJson(true); if (module.PackageJsonChangeId != -1) { module.NegativeChecks.AddRange(negativeChecks.AsSpan()); module.IterationId = IterationId; Result.Modules[name] = module; return(module); } } dir = PathUtils.Parent(dir).ToString(); } module = TSProject.CreateInvalid(name); module.NegativeChecks.TransferFrom(ref negativeChecks); module.IterationId = IterationId; Result.Modules[name] = module; return(null); }
public long CalcIndex() { return(BTreeImpl12.CalcIndex(_stack.AsSpan())); }