MCPcopy
hub / github.com/webpack/webpack / parseAStylesheet

Function parseAStylesheet

lib/css/syntax.js:2059–2072  ·  view source on GitHub ↗
(input, comment)

Source from the content-addressed store, hash-verified

2057 * @returns {Stylesheet} the parsed stylesheet
2058 */
2059const parseAStylesheet = (input, comment) => {
2060 // 1. If input is a byte stream for a stylesheet, decode bytes from input, and set input to the result.
2061 // 2. Normalize input, and set input to the result.
2062 const ts = normalizeIntoTokenStream(input, 0, comment);
2063 useObjectBackend(ts.locConverter);
2064 // 3. Create a new stylesheet, with its location set to location (or null, if location was not passed).
2065 const start = ts.next().start;
2066 const stylesheet = /** @type {Stylesheet} */ (_mkStylesheet(start));
2067 // 4. Consume a stylesheet's contents from input, and set the stylesheet's rules to the result.
2068 _setRules(stylesheet, consumeAStylesheetsContents(ts));
2069 _setEnd(stylesheet, ts.next().start);
2070 // 5. Return the stylesheet.
2071 return stylesheet;
2072};
2073
2074/**
2075 * Parse a stylesheet's contents, CSS Syntax Level 3

Callers 2

rulesFunction · 0.85

Calls 4

normalizeIntoTokenStreamFunction · 0.85
useObjectBackendFunction · 0.85
nextMethod · 0.45

Tested by

no test coverage detected