Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sourcemaps Lookup Laravel Package

spatie/sourcemaps-lookup

Fast, memory-efficient Source Map v3 lookup for PHP. Resolve JavaScript stack frames to original source file, line/column, symbol name, and enclosing scope. Optimized for the read path and high-volume error symbolicating from uploaded sourcemaps.

View on GitHub
Deep Wiki
Context7

title: Tips for bulk lookups weight: 5

Dedupe maps by URL before the frame loop

When you resolve a full stack trace, multiple frames often share the same source map (for example, two frames in the same code-split chunk). Load each unique map once.

$mapsByUrl = [];
foreach ($frames as $frame) {
    $url = $frame['sourceMapUrl'];
    $mapsByUrl[$url] ??= SourceMapLookup::fromJson($fetch($url));
    $positions[] = $mapsByUrl[$url]->lookup($frame['line'], $frame['column']);
}

json_decode dominates the cost of a single cold lookup, so avoiding a redundant decode is the single biggest caller side win.

Multiple lookups against the same map are cheap

Once a line has been looked up, its parsed segments are cached on the SourceMapLookup instance. Subsequent lookups on the same (or later) lines reuse the work. This is the workload the package is tuned for.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony