Commit cc00206
authored
fix(Turbopack): Enable scope hoisting for large files or module counts (#83399)
# Improve BytePos encoding for large source maps
This PR enhances the BytePos encoding mechanism in scope-hoisted modules
to handle larger source maps. The previous implementation had
limitations when dealing with large byte positions, which could cause
errors during source map generation.
## Changes:
- Added a lookup table to store byte positions and module indexes that
are too large for the standard encoding
- Implemented a continuation flag (using the highest bit) to indicate
when a position is stored in the lookup table
- Added a sign extension flag to properly handle padded values
- Updated all relevant code paths to use the new encoding/decoding
mechanism
- Adjusted the header width calculation to accommodate the new flags
- Made the encoding/decoding functions thread-safe with Arc<Mutex<>>
This approach allows us to handle arbitrarily large byte positions while
maintaining backward compatibility with the existing encoding scheme for
smaller values to ensure performance stays as optimal as possible.
Fixes PACK-5244
Fixes #825841 parent c8edeb6 commit cc00206
1 file changed
+384
-115
lines changed
0 commit comments