mirror of
https://github.com/morluto/rea.git
synced 2026-11-05 06:15:59 +00:00
fix(javascript): match source-map originals that name parent directories (#1215)
* fix(javascript): match source-map originals that name parent directories * fix(javascript): resolve parent segments against the source map's directory * fix(javascript): resolve source originals against their map location * fix(javascript): preserve URI and empty source map path semantics * fix(javascript): separate source URL paths from opaque URI payloads * fix(javascript): preserve filesystem names during URI classification * style(javascript): format source URI presence guard * fix(javascript): resolve source map references with URL semantics * fix(javascript): preserve literal UNC source map paths --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
1 parent
24a3aa08d1
commit
889fb374df
4 files changed
+713
-75
No files matched your search
@@ -5,6 +5,7 @@ import {
|
||||
createJavaScriptApplicationNode,
|
||||
} from "./javascriptApplicationGraph.js";
|
||||
import { createHistoricalSourceGraph } from "../referenceSourceGraph.js";
|
||||
import { compareCodePoints } from "../canonicalOrdering.js";
|
||||
import { compareSourceToBundle } from "./sourceToBundleComparison.js";
|
||||
import {
|
||||
SOURCE_TO_BUNDLE_SIGNAL_WEIGHTS,
|
||||
@@ -187,44 +188,47 @@ describe("source to bundle digest changes", () => {
|
||||
});
|
||||
|
||||
describe("source to bundle path syntax", () => {
|
||||
it.each(["src/modified#part.ts", "src/modified?part.ts"])(
|
||||
"preserves literal filesystem punctuation in %s",
|
||||
(path) => {
|
||||
const node = moduleNode("punctuated", { path });
|
||||
const graph = createJavaScriptApplicationGraph({
|
||||
schema: "JavaScriptApplicationGraph",
|
||||
root_node_ids: [node.node_id],
|
||||
nodes: [node],
|
||||
edges: [],
|
||||
coverage: {
|
||||
status: "complete",
|
||||
truncated: false,
|
||||
omitted_count: 0,
|
||||
limits: [],
|
||||
},
|
||||
limitations: [],
|
||||
});
|
||||
const result = compareSourceToBundle({
|
||||
reference: historicalGraph("complete", [path]),
|
||||
application: {
|
||||
evidenceId: EVIDENCE_ID,
|
||||
rootArtifactSha256: HASH.artifact,
|
||||
graph,
|
||||
},
|
||||
});
|
||||
expect(item(result, path)).toMatchObject({
|
||||
status: "unknown",
|
||||
current_node_ids: [node.node_id],
|
||||
candidates: [
|
||||
expect.objectContaining({
|
||||
signals: expect.arrayContaining([
|
||||
expect.objectContaining({ kind: "current-path-exact" }),
|
||||
]),
|
||||
}),
|
||||
],
|
||||
});
|
||||
},
|
||||
);
|
||||
it.each([
|
||||
"src/modified#part.ts",
|
||||
"src/modified?part.ts",
|
||||
"pkg:app/src/modified#part.ts",
|
||||
"pkg:app/src/modified?part.ts",
|
||||
"data:/src/modified.ts",
|
||||
])("preserves literal filesystem punctuation in %s", (path) => {
|
||||
const node = moduleNode("punctuated", { path });
|
||||
const graph = createJavaScriptApplicationGraph({
|
||||
schema: "JavaScriptApplicationGraph",
|
||||
root_node_ids: [node.node_id],
|
||||
nodes: [node],
|
||||
edges: [],
|
||||
coverage: {
|
||||
status: "complete",
|
||||
truncated: false,
|
||||
omitted_count: 0,
|
||||
limits: [],
|
||||
},
|
||||
limitations: [],
|
||||
});
|
||||
const result = compareSourceToBundle({
|
||||
reference: historicalGraph("complete", [path]),
|
||||
application: {
|
||||
evidenceId: EVIDENCE_ID,
|
||||
rootArtifactSha256: HASH.artifact,
|
||||
graph,
|
||||
},
|
||||
});
|
||||
expect(item(result, path)).toMatchObject({
|
||||
status: "unknown",
|
||||
current_node_ids: [node.node_id],
|
||||
candidates: [
|
||||
expect.objectContaining({
|
||||
signals: expect.arrayContaining([
|
||||
expect.objectContaining({ kind: "current-path-exact" }),
|
||||
]),
|
||||
}),
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
"https://example.test/src/modified.ts?revision=2#section",
|
||||
@@ -347,7 +351,7 @@ const historicalGraph = (
|
||||
content_state: "hashed" as const,
|
||||
limitations: [],
|
||||
})),
|
||||
],
|
||||
].sort((left, right) => compareCodePoints(left.path, right.path)),
|
||||
relationships: [],
|
||||
parse_failures: [],
|
||||
exclusions: [],
|
||||
|
||||
Reference in new issue
Block a user