MCPcopy
hub / github.com/webpack/sass-loader / walk

Function walk

test/helpers/getImplementationByName.js:24–41  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

22 const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
23
24 const walk = (node) => {
25 if (typeof node === "string") return node;
26 if (Array.isArray(node)) {
27 for (const item of node) {
28 const r = walk(item);
29 if (r) return r;
30 }
31 }
32 if (node && typeof node === "object") {
33 for (const key of ["node", "import", "default"]) {
34 if (key in node) {
35 const r = walk(node[key]);
36 if (r) return r;
37 }
38 }
39 }
40 return null;
41 };
42
43 const entry =
44 (pkg.exports && walk(pkg.exports["."] ?? pkg.exports)) ??

Callers 1

resolveEsmPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…