MCPcopy
hub / github.com/webpack/webpack / stripFunctionMarker

Method stripFunctionMarker

lib/css/CssParser.js:1887–1912  ·  view source on GitHub ↗
(colon, fn, isLocal)

Source from the content-addressed store, hash-verified

1885 * @returns {void}
1886 */
1887 const stripFunctionMarker = (colon, fn, isLocal) => {
1888 if (!isModules) return;
1889 const fnEnd = A.end(fn);
1890 let stripLeadEnd = fnEnd - 1;
1891 for (const arg of A.children(fn)) {
1892 if (A.type(arg) !== NodeType.Whitespace) {
1893 stripLeadEnd = A.start(arg);
1894 break;
1895 }
1896 }
1897 module.addPresentationalDependency(
1898 new ConstDependency("", [A.start(colon), stripLeadEnd])
1899 );
1900 let trailStart = fnEnd - 1; // position of `)`
1901 if (isLocal) {
1902 while (
1903 trailStart > 0 &&
1904 isCssWhitespace(source.charCodeAt(trailStart - 1))
1905 ) {
1906 trailStart--;
1907 }
1908 }
1909 module.addPresentationalDependency(
1910 new ConstDependency("", [trailStart, fnEnd])
1911 );
1912 };
1913
1914 /**
1915 * Emit the ICSS export for an attribute selector `[class="foo"]` / `[class~="foo"]` (not a composes anchor) by walking the `[…]` block's parsed children. No-op for any other attribute shape.

Callers

nothing calls this directly

Calls 3

isCssWhitespaceFunction · 0.85
typeMethod · 0.45

Tested by

no test coverage detected