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

Function namedExportsOnly

test/helpers/getImplementationsAndAPI.js:20–30  ·  view source on GitHub ↗

* Copy every export from a module namespace except `default` into a plain, * mutable object. ESM namespace properties are non-configurable, so * `node:test`'s `mock.method` cannot replace them in place. The wrapper is * also handed straight to `mock.module`'s `namedExports` in * `implementation-

(ns)

Source from the content-addressed store, hash-verified

18 * @returns {Record<string, unknown>} mutable copy without the `default` key
19 */
20function namedExportsOnly(ns) {
21 const copy = {};
22
23 for (const key of Object.keys(ns)) {
24 if (key !== "default") {
25 copy[key] = ns[key];
26 }
27 }
28
29 return copy;
30}
31
32const sass = namedExportsOnly(sassNs);
33const sassEmbedded = namedExportsOnly(sassEmbeddedNs);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…