mirror of
https://github.com/morluto/rea
synced 2026-10-26 14:25:49 -04:00
fix(javascript): preserve map boundaries and loader provenance
Share embedded-map version admission and derive indexed overlap from represented mappings. Carry createRequire filename bases through worker facts and graph identity. Select factory export bindings at each bundler owner. Validated accepted and malformed source maps through real CLI and stdio MCP codec workflows; verified loader and esbuild graph output against Node runtime controls. Rebased consumer checks passed. Fixes #6803 Fixes #6614 Fixes #6798 Fixes #6797
This commit is contained in:
@@ -296,6 +296,7 @@ const electron = z
|
||||
}));
|
||||
const referenceShape = {
|
||||
...findingContext,
|
||||
resolution_base_path: z.string().exactOptional(),
|
||||
kind: z.enum([
|
||||
"static-import",
|
||||
"dynamic-import",
|
||||
|
||||
@@ -147,10 +147,10 @@ const addSections = ({
|
||||
for (const [index, section] of sections.entries()) {
|
||||
if ((index & 255) === 0) options.check?.();
|
||||
const previous = sections[index - 1];
|
||||
if (previous !== undefined && compare(section.offset, previous.offset) <= 0)
|
||||
if (previous !== undefined && compare(section.offset, previous.offset) < 0)
|
||||
throw new SourceMapFormatFailure(
|
||||
"format",
|
||||
"Indexed section offsets must be strictly increasing.",
|
||||
"Indexed section offsets must be in nondecreasing order.",
|
||||
);
|
||||
const classification = classifySourceMapSection(section);
|
||||
if (classification.kind === "external")
|
||||
@@ -159,7 +159,10 @@ const addSections = ({
|
||||
`External source-map section URL is not fetched: ${classification.url}`,
|
||||
);
|
||||
if (classification.kind === "invalid")
|
||||
throw new SourceMapFormatFailure("format", classification.reason);
|
||||
throw new SourceMapFormatFailure(
|
||||
"format",
|
||||
`${classification.reason} Section path: ${JSON.stringify([...node.path, index])}.`,
|
||||
);
|
||||
embeddedMaps.push(classification.map);
|
||||
}
|
||||
for (let index = sections.length - 1; index >= 0; index -= 1) {
|
||||
@@ -181,11 +184,6 @@ const addSections = ({
|
||||
? nextOffset
|
||||
: node.stop;
|
||||
const offset = addOffset(node.offset, section.offset);
|
||||
if (node.stop !== null && compare(offset, node.stop) >= 0)
|
||||
throw new SourceMapFormatFailure(
|
||||
"format",
|
||||
"Nested source-map section overlaps its enclosing boundary.",
|
||||
);
|
||||
pending.push({
|
||||
value: map,
|
||||
path: [...node.path, index],
|
||||
|
||||
@@ -63,7 +63,8 @@ it("uses the same conservative section classification for URL-plus-map and malfo
|
||||
expect(malformed).toThrow(
|
||||
expect.objectContaining({
|
||||
reason: "format",
|
||||
message: "External source-map section URL must be a string.",
|
||||
message:
|
||||
"External source-map section URL must be a string. Section path: [0].",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user