Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"dependencies": {
"@babel/code-frame": "7.24.2",
"@gemini-testing/commander": "2.15.4",
"@jridgewell/trace-mapping": "0.3.31",
"@jspm/core": "2.0.1",
"@jsquash/png": "3.1.1",
"@puppeteer/browsers": "2.7.1",
Expand Down Expand Up @@ -112,7 +113,6 @@
"sizzle": "2.3.6",
"socket.io": "4.7.5",
"socket.io-client": "4.7.5",
"source-map-js": "1.2.1",
"strftime": "0.10.2",
"strip-ansi": "6.0.1",
"temp": "0.8.3",
Expand Down
2 changes: 1 addition & 1 deletion src/browser/cdp/selectivity/css-selectivity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ export class CSSSelectivity {
rawSourceMap.sources.forEach(sourceFilePath => {
// Ignore generated postcss styles:
// https://github.com/postcss/postcss/blob/eae46db765d752cf8f40c4fa2b0b85030079c43d/lib/map-generator.js#L122
if (sourceFilePath === "<no source>") {
if (!sourceFilePath || sourceFilePath === "<no source>") {
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/browser/cdp/selectivity/fs-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const CacheType = {
TestFile: "t",
Asset: "a",
CssSessionCache: "cs",
SourceMapParseResult: "sm",
} as const;

type CacheTypeValue = (typeof CacheType)[keyof typeof CacheType];
Expand Down
15 changes: 12 additions & 3 deletions src/browser/cdp/selectivity/js-selectivity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { groupBy } from "lodash";
import { resolve as urlResolve } from "node:url";
import { JS_SOURCE_MAP_URL_COMMENT } from "../../../error-snippets/constants";
import { extractSourceFilesDeps, fetchTextWithBrowserFallback, isCachedOnFs, isDataProtocol } from "./utils";
import {
extractSourceFilesDeps,
fetchTextWithBrowserFallback,
isCachedOnFs,
isDataProtocol,
parseSourceMapRanges,
} from "./utils";
import { CacheType, getCachedSelectivityFile, hasCachedSelectivityFile, setCachedSelectivityFile } from "./fs-cache";
import { debugSelectivity } from "./debug";
import type { CDP } from "..";
Expand Down Expand Up @@ -328,11 +334,14 @@ export class JSSelectivity {
throw new Error(`JS Selectivity: fs-cache is broken for ${sourceUrl}`);
}

const dependingSourceFiles = extractSourceFilesDeps(
const parsedSourceMapRanges = await parseSourceMapRanges(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides CDP coverage, we only need ranges "from which source file each part of generated file is derived"

sourceString,
sourceMapsString,
grouppedByScriptCoverage[scriptId],
this._sourceRoot,
);
const dependingSourceFiles = extractSourceFilesDeps(
parsedSourceMapRanges,
grouppedByScriptCoverage[scriptId],
isSourceCodeFile,
);

Expand Down
Loading
Loading