bippy 0.7.3-dev.049a43d → 0.7.3-dev.0ac832d

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.
@@ -207,6 +207,13 @@ export const getSourceFromSourceMap = (
207
207
  );
208
208
  };
209
209
 
210
+ const getStringIndex = (values: string[], target: string): number => {
211
+ for (let valueIndex = 0; valueIndex < values.length; valueIndex++) {
212
+ if (values[valueIndex] === target) return valueIndex;
213
+ }
214
+ return -1;
215
+ };
216
+
210
217
  const getSourceFromMappingsByFunctionName = (
211
218
  mappings: SourceMapMappings,
212
219
  sources: string[],
@@ -215,13 +222,17 @@ const getSourceFromMappingsByFunctionName = (
215
222
  ignoredSourceIndices?: Set<number>,
216
223
  ): StackFrame | null => {
217
224
  if (!names) return null;
218
- const functionNameIndex = names.indexOf(functionName);
225
+ const functionNameIndex = getStringIndex(names, functionName);
219
226
  if (functionNameIndex === -1) return null;
220
227
 
221
228
  let ignoredSource: StackFrame | null = null;
222
- for (const lineMapping of mappings) {
223
- for (const segment of lineMapping) {
229
+ for (let lineIndex = 0; lineIndex < mappings.length; lineIndex++) {
230
+ const lineMapping = mappings[lineIndex];
231
+ for (let segmentIndex = 0; segmentIndex < lineMapping.length; segmentIndex++) {
232
+ const segment = lineMapping[segmentIndex];
224
233
  if (segment[4] !== functionNameIndex) continue;
234
+ if (ignoredSource && segment[1] !== undefined && ignoredSourceIndices?.has(segment[1]))
235
+ continue;
225
236
  const source = getSourceFromSegment(segment, sources, ignoredSourceIndices, names);
226
237
  if (!source) continue;
227
238
  if (!source.isIgnoreListed) return source;
@@ -267,7 +278,7 @@ const findSourceContentByFileName = (
267
278
  fileName: string,
268
279
  ): string | null => {
269
280
  if (!sourcesContent) return null;
270
- const sourceIndex = sources.indexOf(fileName);
281
+ const sourceIndex = getStringIndex(sources, fileName);
271
282
  return sourceIndex === -1 ? null : (sourcesContent[sourceIndex] ?? null);
272
283
  };
273
284